Announcement

Collapse
No announcement yet.

Make it possible to get good looking foliage with V-Ray

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Make it possible to get good looking foliage with V-Ray

    Hi,

    I know I've already made this request but it got lost somewhere, so I would like to bump it again.

    I would like to see "Thin" mode in translucency modes of VRayMTL so that I can make thin translucent materials such as tree leaves without needing two materials. But most important is ability to get translucency without loosing reflection energy. In current state, plugging VRayMTL inside of Vray2sidedMTL immediately results in the loss of reflection energy equal to the translucency amount. This makes it simply impossible to get good looking foliage materials that do not look dry and dull :/

  • #2
    What I do sometimes is use fast sss2 as front material, that makes the transluscency really nice. For the reflection you can layer the twosided material in blend and a vray material over it with frenel, that will give you unmodified reflection.
    Dmitry Vinnik
    Silhouette Images Inc.
    ShowReel:
    https://www.youtube.com/watch?v=qxSJlvSwAhA
    https://www.linkedin.com/in/dmitry-v...-identity-name

    Comment


    • #3
      Originally posted by Morbid Angel View Post
      What I do sometimes is use fast sss2 as front material, that makes the transluscency really nice. For the reflection you can layer the twosided material in blend and a vray material over it with frenel, that will give you unmodified reflection.
      I guess you are right, blend would work, but it's even more unnecessary material nesting in already unnecessarily complicated workflow. And while I haven't tested it yet, I have a hunch that using blend material would have some performance hit, compared to single material.

      Comment


      • #4
        I don't disagree. I wish twosided material was better also, perhaps one day
        Dmitry Vinnik
        Silhouette Images Inc.
        ShowReel:
        https://www.youtube.com/watch?v=qxSJlvSwAhA
        https://www.linkedin.com/in/dmitry-v...-identity-name

        Comment


        • #5
          For V-Ray 3.5, I will be adding the thin translucency to the alSurface material first.

          The Physical Material in 3ds Max 2017 also has a thin translucency option which V-Ray supports.

          However keep in mind that thin-sided translucency does not really represent a leaf material accurately. Leaves have markedly different properties on both sides - f.e. the top side is usually very glossy, whereas the bottom side is fuzzy and diffuse. They also generally have different color. You could certainly use a double-sided texture to map these properties, but it makes the material setup even more complicated than a 2-sided material.

          I could also argue that the 2-sided material is in fact physically accurate and models actual leaves well enough, but at this point I've really given up.

          Best regards,
          Vlado
          Last edited by vlado; 31-12-2016, 12:10 PM.
          I only act like I know everything, Rogers.

          Comment


          • #6
            Well it feels though when you pipe a vray mtl into a 2sided front mtl, the reflection does get dimmed and I don't really understand why. Also, there is really no way to control how thick the material is, and how scattered or how intense the light which penetrates the material becomes. So in the example I had where I had thin skin membranes, 2 sided mtl terminated the light almost immediately after just two membranes, while you would expect it to shine through a lot more.

            Here is an example of what I'm talking about. I took 4 sheets of printer paper and pointed a square directional light at them in a dark room. For the most part 2sided mtl simulates the scattering, with the exception of the center, where in the photograph you clearly see the hot spot from the light source, in vray it almost diminishes. In this scene the sheets are pinned together by a paper clip so they are very close, in maya I have them less then 0.1 mm apart also but I cannot get that translucent feel in the center.





            Second issue I've noticed is that the stacking order of the sheets is rendered incorrectly. If you see how they are layered in maya and in real test, vs how the lighting is scattered on them, it appears the sheets which are furtherest away from light get a lot more light at the edge then they should.



            setup



            Link to scene

            https://drive.google.com/open?id=0B-...2JsSDlHclFxVEE
            https://drive.google.com/open?id=0B-...F9WdHA1YUcwX00
            Last edited by Morbid Angel; 31-12-2016, 02:58 PM.
            Dmitry Vinnik
            Silhouette Images Inc.
            ShowReel:
            https://www.youtube.com/watch?v=qxSJlvSwAhA
            https://www.linkedin.com/in/dmitry-v...-identity-name

            Comment


            • #7
              Ok, challenge accepted How accurate is the Maya scene to the photograph in terms of lighting? I.e. light source size and intensity and camera settings? Is the light source really "diffuse" or it has some kind of directionality (I would assume it is at least somewhat directional, seeing as how it is made of of LEDs)? Do you have an IES profile for it?

              Best regards,
              Vlado
              Last edited by vlado; 31-12-2016, 04:57 PM.
              I only act like I know everything, Rogers.

              Comment


              • #8
                I would say its relative in size. I did not take time to measure it but it should scale up. The scene in maya is in cm and the scale is about the same.

                The issue with LED and accurate light measurement is that, in the light I have, there are two layers of glass (one for bulb it self one for outer layer of light frame glass), there is no way to accurately represent that in 3d. LED IES in general is less efficient then an area light which I've used in many ways, in reality I would not use multiple ies to represent such light, instead I used a regular area light.

                With that said, any given 3d is an approximation of a reference for us for example. Most of the time I don't have data about photo or footage taken. So I have to throw things together and see how they work. In this particular example, though its not 1 to 1 setup with original, you can still see the issues Iv'e outlined. I've tried different exposures, light brightness, 2 sided settings etc, but I could not get the same result as the photo.

                The photo taken with camera cannon eos rebel t2i, iso 400, shutter 1.3, f-number 6.3, aperture f6.4, focal length 21 mm

                I personally have an issue with 2sided, in the fact that it has almost no control on transmission. Its either front or back material, or their mix. But in order to get full translucency like in the example above I have to set the back material to be at 0.85 intensity, I don't believe this is proper, but I need to take more time to confirm these results.

                This is not just coming from me doing a simple paper test. A recent project I found it was difficult to do tree leaves, and we had tough time with the 2 sided mtl. Even back at ILM, they resorted to using a vray mtl with translucency rather then 2sided, which I found was odd.
                Dmitry Vinnik
                Silhouette Images Inc.
                ShowReel:
                https://www.youtube.com/watch?v=qxSJlvSwAhA
                https://www.linkedin.com/in/dmitry-v...-identity-name

                Comment


                • #9
                  While topic of flexible translucency diffusion solution is sure interesting too, I would not like it to hijack my original request of better handling of reflection when it comes to twosided materials. The way translucency part of the effect is currently done is not in direct conflict with getting a realistic looking foliage, while reflection part definitely is.

                  Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	36.2 KB
ID:	866049
                  The picture shows VRayMTL with RGB 255 Color plugged into VRay2Sided with RGB 128 translucency, and VRayMTL with RGB 128 reflection under it. Entire half of the reflection energy gets lost. Let alone clumsy workflow of constantly having to use two materials to create foliage, resulting in workflow overhead and mess like this:
                  Click image for larger version

Name:	2sidedMTLS.JPG
Views:	1
Size:	90.1 KB
ID:	866050
                  And it is all the more important now that we have Glossy fresnel PBR workflow which 2sided mtl effectively breaks.
                  Last edited by LudvikKoutny; 01-01-2017, 11:43 AM.

                  Comment


                  • #10
                    Yeah I was going to get to that part too. I think reducing reflection by average blend amount of the 2sided is not the way I would think it would work. For example reflective part of a surface is not really dependent on its translucency, since its most likely a coat over the translucent surface so it works somewhat independently from the sss part of the leave in this case.
                    Dmitry Vinnik
                    Silhouette Images Inc.
                    ShowReel:
                    https://www.youtube.com/watch?v=qxSJlvSwAhA
                    https://www.linkedin.com/in/dmitry-v...-identity-name

                    Comment


                    • #11
                      Oh boy, it's the leaves debate again. Anyways, I'm curious to know if there's a way to control the spread of the light hotspot with 2sided material or this is only possible with adding real thickness and using SSS material?
                      Aleksandar Mitov
                      www.renarvisuals.com
                      office@renarvisuals.com

                      3ds Max 2023.2.2 + Vray 7 Hotfix 1
                      AMD Ryzen 9 9950X 16-core
                      96GB DDR5
                      GeForce RTX 3090 24GB + GPU Driver 566.14

                      Comment


                      • #12
                        Hey guys, you mind trying out this shader to see if this works better? I'll post some more info on it later.

                        Create a VRayGLSLMat (not tex) and under Quick Shader click enable, then paste in the following code and hit Compile.
                        Code:
                        #version 110
                        
                        // Two sided test material v002
                        // Rens Heeren (mail at rensheeren dot com)
                        // 2017-01-16
                         
                        uniform sampler2D diffuse_color_front;
                        uniform sampler2D diffuse_color_back;
                        uniform int refl_front = 1;
                        uniform float ior_front = 1.5;
                        uniform int refl_back = 1;
                        uniform float ior_back = 1.5;
                        uniform sampler2D depth_tex_front;
                        uniform float depth_mult_front = 1.0;
                        uniform sampler2D depth_tex_back;
                        uniform float depth_mult_back = 1.0;
                        
                        
                        // Schlick simplified Fresnel function, non-metal/non-metal, no polarisation.
                        float fn_FresnelSchlickDiDi(float f_cosai, float f_ni, float f_nt)
                        {
                        	float f_rZero = (f_ni - f_nt) / (f_ni + f_nt);
                        	f_rZero = f_rZero * f_rZero;
                        	float f_out = f_rZero + (1.0 - f_rZero) * pow((1.0 - f_cosai), 5.0);
                        	
                        	return f_out;
                        }
                        
                         
                        void main() {
                        	
                        	// declare and such
                        	bool b_facing  = gl_FrontFacing;
                        	vec3 v3_normal = vr_Normal; //(b_facing) ? vr_Normal : -vr_Normal;
                        	vec3 v3_normalFlipped = -vr_Normal; //v3_normal;
                        	//v3_normalFlipped[2] *= -1.0;
                        	
                        	float f_cosaiF = abs(dot(-vr_Direction, v3_normal));
                        	float f_cosaiB = abs(dot(-vr_Direction, v3_normalFlipped));
                        	
                        	vec3 v3_pos = vr_Position;
                        	vec3 v3_viewDir = vr_Direction;
                        	vr_LightIterator o_lightIt;
                        	
                        	vr_TraceOptions o_options;
                            o_options.rayType = VR_TRACE_REFLECT;
                            o_options.rayGroup = VR_SPECULAR_DISPERSAL;
                            
                        	bool b_reflF = bool(refl_front);
                        	bool b_reflB = bool(refl_back);
                        	float f_iorF = ior_front;
                        	float f_iorB = ior_back;
                        	vec4 v4_depthTexF = vec4(vec3(texture2D(depth_tex_front, vec2(gl_TexCoord[0]))), 1.0) + vec4(1.0);
                        	vec4 v4_depthTexB = vec4(vec3(texture2D(depth_tex_back, vec2(gl_TexCoord[0]))), 1.0) + vec4(1.0);
                        	float f_depthMultF = depth_mult_front;
                        	float f_depthMultB = depth_mult_back;
                        	vec4 v4_diffTexF = vec4(vec3(texture2D(diffuse_color_front, vec2(gl_TexCoord[0]))), 1.0);
                        	vec4 v4_diffTexB = vec4(vec3(texture2D(diffuse_color_back, vec2(gl_TexCoord[0]))), 1.0);
                        	vec4 v4_diffF = vec4(0.0, 0.0, 0.0, 1.0);
                        	vec4 v4_diffB = vec4(0.0, 0.0, 0.0, 1.0);
                        	vec4 v4_diffRawF = vec4(0.0, 0.0, 0.0, 1.0);
                        	vec4 v4_diffRawB = vec4(0.0, 0.0, 0.0, 1.0);
                        	vec4 v4_diffAttF = vec4(0.0, 0.0, 0.0, 1.0);
                        	vec4 v4_diffAttB = vec4(0.0, 0.0, 0.0, 1.0);
                        	vec4 v4_refl = vec4(0.0, 0.0, 0.0, 1.0);
                        	
                        	vec4 v4_depthF = v4_depthTexF * vec4(vec3(f_depthMultF), 1.0);
                        	vec4 v4_depthB = v4_depthTexB * vec4(vec3(f_depthMultB), 1.0);
                        	
                        	float f_reflAmtF = 0.0;
                        	float f_reflAmtB = 0.0;
                        	float f_reflAmtInvF = 1.0;
                        	float f_reflAmtInvB = 1.0;
                        	
                        	
                        	// light loop
                        	vr_LightIterator o_light;
                        	for(int j = 0; j < vr_NumLights; ++j) 
                        	{
                        		vr_evalLight(j, v3_pos, v3_normal, o_light);
                        
                        		float cos_nl = clamp(o_light.dot_nl, 0.0, 1.0);
                        		if (cos_nl > 0.0) 
                        		{
                        			v4_diffRawF += vec4(cos_nl * o_light.contribution, 0.0);
                        		}
                        		
                        		vr_evalLight(j, v3_pos, v3_normalFlipped, o_light);
                        
                        		cos_nl = clamp(o_light.dot_nl, 0.0, 1.0);
                        		if (cos_nl > 0.0) 
                        		{
                        			v4_diffRawB += vec4(cos_nl * o_light.contribution, 0.0);
                        		}
                        	}
                        	
                        	// GI
                        	v4_diffRawF += vec4(vr_irradiance(v3_normal, 1.0), 1.0);
                        	v4_diffRawB += vec4(vr_irradiance(v3_normalFlipped, 1.0), 1.0);
                        	
                        	// front facing
                        	if (b_facing)
                        	{
                        		// refl
                        		if (b_reflB)
                        		{
                        			f_reflAmtB = fn_FresnelSchlickDiDi(f_cosaiB, 1.0, f_iorB);
                        			f_reflAmtInvB = 1.0 - f_reflAmtB;
                        		}
                        		if (b_reflF)
                        		{
                        			o_options.normal = v3_normal;
                        			v4_refl = gl_FragColor = vr_trace(o_options);
                        			f_reflAmtF = fn_FresnelSchlickDiDi(f_cosaiF, 1.0, f_iorF);
                        			f_reflAmtInvF = 1.0 - f_reflAmtF;
                        			
                        			v4_refl *= f_reflAmtF;
                        		}
                        		
                        		// 2-sided calc
                        		v4_diffF = v4_diffRawF * f_reflAmtInvF * v4_diffTexF;
                        		v4_diffTexF = pow(v4_diffTexF, v4_depthF);
                        		v4_diffAttF = f_reflAmtInvF * v4_diffTexF;
                        		
                        		v4_diffTexB = pow(v4_diffTexB, v4_depthB);
                        		v4_diffB = v4_diffRawB * f_reflAmtInvB * v4_diffTexB * v4_diffAttF;
                        		
                        		gl_FragColor = v4_refl + v4_diffF + v4_diffB;
                        	}
                        	else // back facing
                        	{
                        		// refl
                        		if (b_reflB)
                        		{
                        			o_options.normal = v3_normalFlipped;
                        			v4_refl = gl_FragColor = vr_trace(o_options);
                        			f_reflAmtB = fn_FresnelSchlickDiDi(f_cosaiB, 1.0, f_iorB);
                        			f_reflAmtInvB = 1.0 - f_reflAmtB;
                        			v4_refl *= f_reflAmtB;
                        		}
                        		if (b_reflF)
                        		{
                        			f_reflAmtF = fn_FresnelSchlickDiDi(f_cosaiF, 1.0, f_iorF);
                        			f_reflAmtInvF = 1.0 - f_reflAmtF;
                        		}
                        		
                        		// 2-sided calc
                        		v4_diffB = v4_diffRawB * f_reflAmtInvB * v4_diffTexB;
                        		v4_diffTexB = pow(v4_diffTexB, v4_depthB);
                        		v4_diffAttB = f_reflAmtInvB * v4_diffTexB;
                        		
                        		v4_diffTexF = pow(v4_diffTexF, v4_depthF);
                        		v4_diffF = v4_diffRawF * f_reflAmtInvF * v4_diffTexF * v4_diffAttB;
                        		
                        		gl_FragColor = v4_refl + v4_diffF + v4_diffB;
                        	}
                        }
                        As this is a single shader and not a shader blending two others it can properly mix the subsurface effects without the surface reflection.
                        I have a depth map input as well as the default diff map input as in for example paper the blotchiness you see when lit from behind is a depth effect, not a material colour effect.
                        No fake specular highlights (for example phong) yet, and no glossy reflections. No subsurface scattering, just simulating a thin layer.
                        Rens Heeren
                        Generalist
                        WEBSITE - IMDB - LINKEDIN - OSL SHADERS

                        Comment

                        Working...
                        X