multiple refraction layers

I am trying to add multiple refraction layers for dispersion. However the layer stack begin s summing the additional layers. example Rf1 transparency Blue RF2 transparency Red. The resulting image = blue and yellow refractions minus the red as it becomes filtered. Change the stack to RF1 Red and RF2 blue and the resulting refractions = Red and Green. I am searching for a way to get Red - Blue - Green with the proper resulting refractions minus the sum of the RGB’s being filtered.

Re: multiple refraction layers

After talking with Vlado we found that it is possible to turn on an additive mode rather than the current blending based on transparency. It is possible, when using additive mode, to break the law of conservation of energy - which is obviously not physically correct. But regardless will look into how to incorporate this, and see whether switching to additive will help in the case of dispersion.

Re: multiple refraction layers

whoot! that sounds like good news i guess lol. thanks Joe.

Re: multiple refraction layers

Travis, did you try a dispersion effect and have no luck? I’m not sure I understand the question. But, some weeks befor I have done this dispersion test:

The trick is, to set the RGB of the layers 1,1,0 → 0,1,1 → 1,0,1 (1…100%) and set the option disable volume fog. A little bit refraction blur makes the colors mixed.

Re: multiple refraction layers

Travis,

I was gonna just send you an email, but I figured it would benefit everyone if I just posted it here. First off I want to apologize for telling you the wrong dispersion setup from the start. I miss understood the setup Joe told me so thats my fault. Also something to keep in the back of your mind is that this is not a physically correct setup, so it has its own pitfalls.

So here’s the explanation of how the current dispersion setup needs to work in vfr and why the one that had previously relayed to you didn’t work. For this explanation I will refer to float color values rather than the typical 8 bit (0-255) color values as this will make the explanation clearer. Also, in order to get this all to work you have to use the Disable Volume Fog option.

Transparency
The key component in the dispersion is the idea of layer transparency. Typically layer transparency is set through grayscale values, and what this effectively does is filter each of the RGB components equally, thus resulting an even transparency level across all colors. With dispersion, we are tricking this transparency by choosing not to use grayscale values, but instead using a color value to filter the transparency differently across each color component.

So with this in mind the transparency color becomes very important in determining the end result. Keep in mind that a color value of 0 (black) for a given color component blocks that color component from passing through that layer and a color value of 1 (white) will allow that color component to be read by a lower layer. So with that in mind we need to filter out each color component individually, while allowing the other colors to pass through to other layers. That being said here is the breakdown.

To filter the red component: R=0, G=1, B=1 ; Resulting transparency color is Cyan
To filter the green component: R=1, G=0, B=1 ; Resulting transparency color is Magenta
To filter the blue component: R=1, G=1, B=0 ; Resulting transparency color is Yellow.

As you can see to filter a given color component the transparency color needed is actually the inverse of that color. More on this a little later.

IOR Values
So now that we have the transparency all worked out, the other major piece of the puzzle is the IOR value for each refraction layer. Basically the more spread out the IOR values of each layer are, the more pronounced the dispersion affect will be. This will allow you a level of control to make it work how you need it. As a rule of thumb I typically have a .05 difference between IOR values (ie. 2.55, 2.6, and 2.65). In my opinion this is a little wide of a range, so typically if I do adjust the affect I almost always make less of a difference between the layers (ie. 2.58, 2.6, 2.62).

Layer Order
With this setup, the layer order of the refraction layers WILL NOT matter. Meaning that if you change the order of the layers by moving one above or below another, then the output will not change. However, changing the association between a given IOR value and Transparency color (ie associating an IOR of 2.6 with Cyan when you originally had it with Yellow) WILL change the end result. This is because having the different IOR values essentially makes 3 different results which then get filtered via the transparency. If a given IOR is filtered differently, then that will most certainly cause a change in output.

Explanation of errors in previous setup    (If your new to dispersion then you don’t have to read this)
The main thing that was wrong with the previous setup was the transparency colors. When Joe told me to set the layer transparency to red, green, and blue I thought he meant those colors, and Gjis’ post over in the ChaosGroup forum only solidified that for me (you can find that here). But what that setup effectively did is filter out more light then should have been, effectively not allowing any light to reach the lower layers. Heres a break down

Transparency Color=Red; R=1,G=0,B=0; Only Red is allowed to pass through
Transparency Color=Green; R=0,G=1,B=0; Only Green is allowed to pass through
Transparency Color=Blue; R=0,G=0,B=1; Only Blue is allowed to pass through

So as you can see no matter which order you pick for the colors, no light is allowed pass the first two layers. What this also does is make the filtered colors very odd. If the you had the colors in the order explained above, the Red transparency would actual contribute its colors as a cyan rather than a red. And no matter what the second color is, its contribution is effectively red. This means that the result doesn’t separate the colors evenly across all of the colors.

So thats the breakdown of the current situation with dispersion. Its not physically correct, which is why you have to do the whole color IOR thing, but with the correct setup it will work just fine. Joe is looking into using an additive mode for dispersion, which would simplify the setup a little bit, but he’s not sure what will come of that. I am also going to look into a setup with more than 3 colors, although I’m not sure what the end result will be. Hope this helps explain everything better than it was before.

Re: multiple refraction layers

Micha (you were posted while I was writing my explanation, so I hope you go back and read it)

Chances are your not changing the IOR values for each of the refraction layers. If you don’t do that then the result of each layer is the same, so the result will effectively be the same for each, which means no refraction.

Also Travis’s question extends back to some emails/pm he had with Joe and I. So his issue wasn’t that he wasn’t getting dispersion, but that it wasn’t acting the way it was supposed too.

Re: multiple refraction layers

Different Layer Order, but the colors <=> IOR values stay the same. End result is the same.

Re: multiple refraction layers

The yellow magenta cyan version does produce better results thats for sure. I suppose it is because of how the filtering is working. This does work much better, but I am not so certain that this is really doing what we all really want.

I will play around with this some more and see what I find.

Thanks Damien!

Re: multiple refraction layers

Thanks Damien for the detailed explanation, it’s the same method like I used. Additional I used a little refraction blur. Side effect of three refraction layers and blurieness: much longer render time.

PS: I vote for an user tutorial forum. :wink:

Re: multiple refraction layers

Yes the blur does drive up render times, especially with a higher max depth.. It would make rendering a piece with a lot of stones near impossible or at least impractical for most people. Well we are 100% further along the path from where we were a year ago with this stuff so that’s the good news. I think vfr is getting really close to nailing it perfectly, just needs a few more tweaks and i think we’ll be on to something :slight_smile:

Re: multiple refraction layers

Although I agree with Micha that effect is much better with just a little refraction blur, it just takes way too long. In the case of dispersion its really an issue of whether that time could be spend rendering something with a higher max depth or a little refraction blur, and for use with gems or diamonds a higher max depth is much more useful in my mind.

Also, you’ve got to remember that since there are 3 different refraction layers are used the amount of rays that would need to be traced is now 3 fold. Adding glossiness to that, even with a low subdivisions like 4 or something, is taking 3 rays that need to be traced for sharp refractions to something like 48 rays for glossy refractions.

I am working on a 6 color version, but as expected its taking a long time to render. So once I get that working I’ll post the details. My hope is that it will yield a smoother separation of light between the different color components. Right now its just a little too harsh to look good.

Re: multiple refraction layers

Rendertime … it’s not soooo hard, my example above need approx. 1h at 800x600 (QuadCore). I think, often, stones are not so big at the image or?

Re: multiple refraction layers

here’s what to shoot for.

this was done in under 3 minutes using brazil. (i know i know, stupid brazil!)

hey btw, thanks for finally turning on attachments in SMF!

Re: multiple refraction layers

If you have the time, then by all means use it. But a good Max Depth setting is certainly a must for good gems and that takes time itself. I just spent an hour on a dispersion material with glossiness and got only 4-5 buckets in. Granted my machine is slow, but the glossiness still adds much more than need be calculated.

Re: multiple refraction layers

sometimes if we do a close up shot of the model they are. Most of the time though you are right they are about 1/4 of that size in the render. The problem i see with this method is some models have 100+ stones. Even at smaller sizes, this method would require some serious time. I think you are correct though in using the blur to blend the banding refractions to more of a natural dispersed appearance. It is certainly a more correct looking image, but I am not so sure the time trade off makes it worth it. Thanks for playing with it and giving it a try.

Re: multiple refraction layers

In reference to the brazil render (please don’t yell at me :-[ ), there is one thing that would be great to duplicate. If you notice that on some of the facets have multiple colors blended on one facet. So far, I have only been able to get a single color to show on a facet. Does that make sense? For example, if you look towards the upper right of the stone in that render, you will see a facet that blends from yellow to red. Is something like this possible?

Matt

Re: multiple refraction layers

Well, I think the colors are getting to be more where I want them. However, I’ve noticed something else that I’m having trouble with. The facets on the front of the stone should, in my opinion, have more of a highlight. Right now, they seem to be too transparent. I have been playing with the amount of reflection, but there is a fine line between not enough and too much. :stuck_out_tongue:

I will keep playing, and hopefully have some decent settings to post.

Re: multiple refraction layers

I agree that the front facets should be more visible. I would say that the easiest way to tweek that is by changing the minimum reflection layer within the fresnel settings (Reflection layer> Reflection Map) and change the black color to a dark gray-ish color. That and also making sure that the two IORs in the fresnel settings are the same is also important (some people only change the fresnel IOR and not the refraction IOR as well)

Re: multiple refraction layers

Damien, thanks! I think I have the color set to a gray already, but the IOR’s are different. I’ll keep my fingers crossed.

Also, I gave something different a try. I added a second reflection layer, and removed both fresnel maps. I tweaked the reflection / glossiness from there. Here’s what I got, but still not wonderful.

Re: multiple refraction layers

Hey Damien, This might be a silly question but here it is anyway.

Where is, or what is the determining angle vray uses for the fresnel layers. Meaning, in most apps we have control over perp to camera or perp to a UVW or just a specified camera angle or global angle. What is vrays determining angle? It looks to be perp to camera? If so, can we change the determining angle? I know that a variance in IOR will control the specular values of the fresnel reflections, but is it possible to adjust the min/max angle in which the two layers merge and split?