Sun, Nov 24, 10:44 AM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 21 6:06 am)



Subject: Ockham, Bagginsbill, I need help with snow shader.


  • 1
  • 2
Helgard ( ) posted Fri, 13 June 2008 at 2:26 PM · edited Sun, 24 November 2024 at 10:43 AM

Attached Link: Shader

file_408265.jpg

I have written a snow shader.

What this does is adds snow to all surfaces facing upwards. There are many possibilities with this, and I need help from the community to develop it further.

This is the basic shader:

www.3dactorsguild.com/snowshader.zip

I have a much more advanced shader, but this one will be easier for a start, because it is easier to see what is going on. In the more advanced one I have things like trancelucency, refraction, etc, but before we work on that, I have a major problem.

I need a python script that adds this to the existing material, instead of replacing it. At the moment, if you add the shader to the material, it replaces all the other materials. I need a python script that will add this to all the materials in the scene.

So, here is the shader, feel free to mess with it, write python scripts, improve it, etc. If anyone improves it and needs a place to host it, we can do that on Vanishing Point.

Thanks

Helgard


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 2:27 PM

file_408266.jpg

Here is a rough quick pic of the basic shader


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 2:48 PM

file_408267.jpg

Snow percentage at 30%


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 2:48 PM

file_408268.jpg

Snow percentage at 50%


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 3:44 PM

file_408271.jpg

Applied to a building prop at 50%


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 3:44 PM

file_408272.jpg

Close up


Your specialist military, sci-fi, historical and real world site.


semidieu ( ) posted Fri, 13 June 2008 at 4:19 PM

I'm not BB and not ockham :)

But here is a script that does it. As it is set, it applies to all materials of the selected figure. The script can then be modified to apply to specific part, props, materials, etc...

Select a figure and run the script using 'File->Run python script' and browse for the file included in the zip file.


semidieu ( ) posted Fri, 13 June 2008 at 4:21 PM

file_408281.txt

Zip file doesn't work...

I renamed it to '.txt'. So save it as a ZIP file :D


semidieu ( ) posted Fri, 13 June 2008 at 4:21 PM

And the next time, I will attach the PY file directly, with another extension :D


Helgard ( ) posted Fri, 13 June 2008 at 4:34 PM

Traceback (most recent call last):
  File "C:Program FilesSmith MicroPoser ProRuntimePythonposerscriptsaddSnow.py", line 90, in ?
    for m in F.Materials():
AttributeError: 'NoneType' object has no attribute 'Materials'


That is in PoserPro, I will try it in Poser 7


Your specialist military, sci-fi, historical and real world site.


JOELGLAINE ( ) posted Fri, 13 June 2008 at 4:37 PM

Bookmark!  This looks very interesting!

I cannot save the world. Only my little piece of it. If we all act together, we can save the world.--Nelson Mandela
An  inconsistent hobgoblin is the fool of little minds
Taking "Just do it" to a whole new level!   


Helgard ( ) posted Fri, 13 June 2008 at 4:44 PM

Ok, it works on figures, but not on props. Will make render and paste.


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 4:51 PM

file_408282.jpg

OK, it works on figures.

Another small problem. Sometimes you have materials on which you wouldn't want snow, like say for instance the interior of a building or on water, like a pond. So eventually we are going to have to write this python script with a GUI with an option to choose which materials, and also with the option to set the snow percentage.

But so far, it is working like a charm. I will work on the actual snow shader, and improve that, and leave it up to all the clever people to work on the python.

Helgard


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 5:02 PM

file_408283.jpg

Building as it loads from the Poser library


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Fri, 13 June 2008 at 5:03 PM · edited Fri, 13 June 2008 at 5:12 PM

file_408284.jpg

Same building after running the python script. It took me literally less than 20 seconds to make this a snow scene.


Your specialist military, sci-fi, historical and real world site.


momodot ( ) posted Fri, 13 June 2008 at 9:06 PM

This is so cool. Could you make it to do dirt in crevases/recesses? I would love to have something like this to make dilapidated/dirty scenes!



Helgard ( ) posted Fri, 13 June 2008 at 10:11 PM · edited Fri, 13 June 2008 at 10:12 PM

Momodot,

A few practical considerations.

In the snow shader, I am using the alternate diffuse, so it doesn't replace the texture underneath. I am replacing the bump and displacement, because snow will cover the bump and displacement of whatever is underneath.

So if I make dirt it has to be in the alternate diffuse, so as not to replace the original texture.

Now, I can control the direction, and height of what I am adding to a material. In the snow, I am using direction, all the surfaces facing up get snow. In another version of the snow shader I made, I also control the height, so that snow only occurs from a certain height up, like on a mountain, which is not very practical for Poser, that is more what you would need in Vue.

I can add mud to the bottom of things, such as saying that everything below a ceratin level must get some mud, such as wheels going through mud, but also not very practical. I know there is a way to add dirt using the gather node that someone else worked out, but I am not sure how far they got, I will search for the thread and see if I can find it.


Your specialist military, sci-fi, historical and real world site.


momodot ( ) posted Fri, 13 June 2008 at 11:09 PM

Oh. Thanks for giving it thought :)

It is really really cool what you have done here! I never would have thought such a thing possible.

I had figured it might be possible to add dirt as an edge_blender thing... lately I have put edge_blender on my IBL lights to darken the edges/crevases and that is going really well. I once tried to use the edge_blender to get a look like stippled shading for a"hand  drawn" look but it didn't work out.



lesbentley ( ) posted Sat, 14 June 2008 at 5:16 AM

Great idea Helgard. The snow on the red thingimebob looks especially impressive!


bagginsbill ( ) posted Sat, 14 June 2008 at 8:28 AM

Hi people - just got back from a work trip. Sorry I did not participate till now.

Helgard,

You said "In the snow shader, I am using the alternate diffuse, so it doesn't replace the texture underneath." What does that mean?

The Alternate_Diffuse input is a pass-through channel - it sends whatever you put in there to the render, added to all the other stuff the root node is processing. You are not covering up the original shader, you are just overwhelming the final rendered pixel with whiteness. While that works for a simplistic snow shader that results in RGB 255, 255, 255 all the time (because of clipping) it is not a technique that will work for realism shaders.

Photographs of snow-covered buildings do not yield RGB 255, 255, 255 all the time. As soon as you make the snow shader produce shades of gray, the underlying texture will be mixed in. Similarly, if you were to try this technique for rust, dirt, scratches, and so on, you'd find that you have to do a lot more than plug something into Alternate_Diffuse.

Finally, you'd really screw up one of my complex shaders, which are entirely hanging off the Alternate_Diffuse input already!

You actually need to take over the whole shader for areas where the snow is 100% opaque, but not 100% white. This requires some analysis of the existing shader and then a number of blends to mix the snow shader with it.

My matmatic utility can do this - the function is called Mix. It will mix two shaders into one shader. However, matmatic is "write only" - meaning it doesn't let you read an existing shader, modify it, then write it. It simply writes it. Also, matmatic does not operate in-scene, but rather just produces files.

My new Versatile Shader System (VSS), does do in-scene material editing, does read existing shaders, and can "mix" shaders. In VSS, these are called "effects shaders", as opposed to "template shaders". A template shader might be "concrete" or "skin", while an effect shader might be "snow" or "lipstick." - in other words, effect shaders are mostly for layering on another virtual material on part of the prop or figure.

I have not shown these to anybody yet. But the point I'm making is this is a little bit tricky to do in the general case, and writing scripts for special cases is fine, but doesn't scale. However, you can get away with it for snow - leaving realism out of it, of course.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Sat, 14 June 2008 at 9:59 AM

file_408338.jpg

Not related to the script here, per se, but I just thought you guys might be interested in this.

I've been tweaking a snow shader off-and-on for a few months. A realistic snow shader is almost the same as a realistic skin shader. It needs to have gamma correction and subsurface scattering, or it won't look real. A naive skin shader looks like plastic, and a naive snow shader looks like styrofoam.

I'm not saying I moved away from styrofoam yet - my wife just declared to me that this render is of styrofoam. Still I'm making progress. It's 20 nodes so far, most of it very similar to my VSS skin shader.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Sat, 14 June 2008 at 10:00 AM

file_408339.jpg

Here it is applied to a log (un modified log on the left for comparison.)


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Sat, 14 June 2008 at 10:01 AM

One thing about snow that is not like skin - it has tiny prismatic (colorful) specular reflections. Click the render to see full size, then look carefully for the tiny bits of rainbow colors.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Sat, 14 June 2008 at 12:14 PM

file_408348.jpg

This is a good style of test device for many shaders. You want to see how it reacts to light/camera angles. A bunch of balls surrounding a point light source gives you many different angles all at once.

Take a look at the front-most ball. There is a strange anomaly there, where the specular gets dark instead of light. I have to figure out what that is, before I give you guys this shader.

(Click for full size)


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


Helgard ( ) posted Sat, 14 June 2008 at 12:50 PM

Bagginsbill,

Like I said above, in the first post, this is a very simplified version of the shader. The original shader I made about two years ago, and it has about 60 nodes in it, but I stripped it down for this, because all I was looking for in this thread was a way of applying it to all the materials in a scene.

The original shader included functions like controlling the height, so that you could tell it at what height to start applying snow, such as in mountain scenes, and the original shader included all the light properties, like trancelucency, SSS, etc.

The thing I need is a way to add the shader to a scene, without wiping out all the existing textures in the scene, which this script does, but unfortunately it is only working on figures at the moment. Feel free to take this shader and ideas, and improve it, modify it, find better ways of making it work, etc.

I will make what I have so far available as a freebie, and when someone makes a better version, then that will be very cool. I just slapped this together out of a two year old shader because someone was looking for snow covered props in another thread, and I don't really have time now to spend time on this, I have my hands full with various other projects.


Your specialist military, sci-fi, historical and real world site.


semidieu ( ) posted Sat, 14 June 2008 at 1:14 PM

The script I made was for 'testing'. Now, it it's ok, it will be easy to make a GUI to choose figures, props and materials on which you want to apply.

I already created a script that allows to easily build graphical user interface to select figures/props/materials.

Also, it can be easy to create a script to customize the shader automatically. Let me know :D


Helgard ( ) posted Sat, 14 June 2008 at 3:05 PM

OK, two confessions to make. Firstly, I have never actually seen snow, lol, I come from a very warm country. Second, I made this shader about two years ago, and I can't remember what all the nodes actually do.

So I am going to spend some time trying to figure out the maths nodes in the shader again, and improving that.

In the meantime, do whatever you can on the python. The main considerations are that we must be able to choose materials. For example, if you have a car in the snow, you don't actually want snow inside the car, so we must have the option to exclude certain materials. Second, we need to be able to set the value of Y in the first post picture to a value between 0 and 1. If we could set the amount of bump on the snow that may help as well. I think we should remove the displacement from the shader though, that worked in the original context of this shader, but it doesn't work that well in the current application.


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Sat, 14 June 2008 at 3:09 PM

Attached Link: Snow shader and python script

For anyone who wants to play with it so far, and maybe make some suggestions, here is the current state of the product.


Your specialist military, sci-fi, historical and real world site.


JOELGLAINE ( ) posted Sat, 14 June 2008 at 4:34 PM

I'll play with it.  Where I live with global warming, I saw snow 15+ years ago. I remember it!  It was white, sorta like cream cheese with a little blue added and didn't have much taste. LOLOLOL :lol:

I cannot save the world. Only my little piece of it. If we all act together, we can save the world.--Nelson Mandela
An  inconsistent hobgoblin is the fool of little minds
Taking "Just do it" to a whole new level!   


semidieu ( ) posted Sat, 14 June 2008 at 4:38 PM

OK. I'll work on a little graphical interface and will upload something as soon as I have something, with some specific customizations.


Conniekat8 ( ) posted Sat, 14 June 2008 at 5:24 PM

BM ... awesome work here guys! 
I'm sure I'll need a snow shader at some point :)

Hi, my namez: "NO, Bad Kitteh, NO!"  Whaz yurs?
BadKittehCo Store  BadKittehCo Freebies and product support


Miss Nancy ( ) posted Sat, 14 June 2008 at 5:33 PM

I also wanna say how impressed I am with this item from Helgard et al.
one idea (in case nobody mentioned): some way to keep areas under
canopies or eaves or whatever from getting the snow fx.



Helgard ( ) posted Sat, 14 June 2008 at 6:03 PM

Miss Nancy,

I think in the final version you will be able to choose which objects in the scene get the snow, and on the individual objects you will be able to select which materials. So for example a porch that has a seperate material will be able to be excluded if it is under a roof, but I don't think there will be a way to select specific areas of a material to have snow or not. It would be possible to do that with masks, etc, but that would have to be done individually for each specific material and model, so that would not be feasible for a shader that is supposed to work on any scene.

Helgard


Your specialist military, sci-fi, historical and real world site.


ghonma ( ) posted Sat, 14 June 2008 at 7:00 PM

Quote - It would be possible to do that with masks, etc, but that would have to be done individually for each specific material and model, so that would not be feasible for a shader that is supposed to work on any scene.

You could do it with AO. The areas inside of nooks and crannies, and those covered by other objects would get less snow, which is exactly the kind of map you get with AO.


Helgard ( ) posted Sat, 14 June 2008 at 7:33 PM

ghonma,

I have been experimenting with just that effect, but I am not getting it right. No matter what I do, the AO is affecting all the materials in the scene, not just the placement of the snow. You have any idea of where exactly to plug in the AO to get this effect. I know it should work, but my brain is not "getting it".

Helgard


Your specialist military, sci-fi, historical and real world site.


Robo2010 ( ) posted Sat, 14 June 2008 at 7:36 PM

How about on trees?


Helgard ( ) posted Sat, 14 June 2008 at 9:46 PM

file_408365.jpg

Robo, the whole idea behind making the stuff available is for you to download it and try it out. Here is a couple of trees, from the Syama Forest Trees for Poser set.


Your specialist military, sci-fi, historical and real world site.


Helgard ( ) posted Sat, 14 June 2008 at 9:47 PM

file_408366.jpg

Here are the same trees after running the Poser script. Took all of three minutes to load the trees and run the script.


Your specialist military, sci-fi, historical and real world site.


Robo2010 ( ) posted Sat, 14 June 2008 at 10:15 PM

Kewl, downloading the latest.


JHoagland ( ) posted Sun, 15 June 2008 at 12:44 PM

That is a very cool script. Excellent job!
Thanks for the "Christmas in June" image ideas. :)

But I just want to say that, as someone who used to live in a snow area, I'm glad to be gone.
The only snow we get here in Orlando is the fake snow during the Christmas events at Disney World.

I grew up in the Baltimore, Maryland area and I got sick of the snow and ice and ice-covered snow. Although snow-covered object may be pretty to look at (just like these sample renders), it's a pain in the **** to drive in.

--John


VanishingPoint... Advanced 3D Modeling Solutions


Helgard ( ) posted Sun, 15 June 2008 at 1:27 PM

Where I come from, it never snowed. In fact, it hardly ever rained. In one town it hadn't rained for 15 years. When it did rain, the doctors had to give the small children calming tablets, because they didn't know what rain was, and some of them got very panicked. The old "the sky is falling syndrome" that fairy tales always joke about.


Your specialist military, sci-fi, historical and real world site.


estherau ( ) posted Sun, 15 June 2008 at 7:48 PM

 this looks awsome!

MY ONLINE COMIC IS NOW LIVE

I aim to update it about once a month.  Oh, and it's free!


ranman38 ( ) posted Tue, 17 June 2008 at 9:53 AM

Can't wait for the python script. Nothing like having cools things happen with a couple clicks.



Marque ( ) posted Wed, 18 June 2008 at 8:34 AM

bm


adp001 ( ) posted Wed, 02 July 2008 at 5:26 PM

Nothing news about snow? What about a "wacro"?




Helgard ( ) posted Thu, 03 July 2008 at 7:59 AM

We are still working on this. We are trying to make it as easy and simple to use as possible. Hopefully be ready soon.


Your specialist military, sci-fi, historical and real world site.


jjsemp ( ) posted Wed, 16 July 2008 at 6:58 PM

Bookmark and thanks!


DarkEdge ( ) posted Wed, 16 July 2008 at 8:33 PM

Nice work everyone, I would like to jump aboard! 😄

Comitted to excellence through art.


bwldrd ( ) posted Wed, 20 August 2008 at 5:21 AM

Any update on this?  Still in the works, given up?  Etc.

--------------------------------------------------------------------------------

Consider me insane if you wish, but is your reality any better?


Helgard ( ) posted Wed, 20 August 2008 at 5:56 AM

Not sure, I will contact Semideau and see how far hhas got with the python GUI.


Your specialist military, sci-fi, historical and real world site.


bwldrd ( ) posted Thu, 21 August 2008 at 12:39 AM

Ok.  Thank you.

--------------------------------------------------------------------------------

Consider me insane if you wish, but is your reality any better?


  • 1
  • 2

Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.