Jump to content

shadmar

Members
  • Posts

    3,618
  • Joined

  • Last visited

Posts posted by shadmar

  1. @thehankinator : Will the waterbug (look into) vanish if you set reflection camera to MSAA=2 ?

     

       --check if we have reflection camera.
       self.world=World:GetCurrent()
       if self.rcamera==nil then
           for i=self.world:CountEntities()-1,0,-1 do
    				    if self.world:GetEntity(i):GetClass()==Object.CameraClass then
                               if self.world:GetEntity(i):GetScale().y<0 then
                                   self.rcamera=self.world:GetEntity(i)
    						    tolua.cast(self.rcamera,"Camera")
    						    System:Print("..found reflection cam")
    						    self.rcamera:SetMultisampleMode(2)
                                   break
                               end
    				    end
    		    end
      end
    

    • Upvote 1
  2. Why would you use a tesselation material on those?

    Tesselated materials should only be used with certain care, since it will tesselate and explode your verts along the normals or heigthmap.

    So for walls (no curved) or other flat single material models yes, otherwise no.

    • Upvote 1
  3. normals should be sampled like this I believe:

    vec3 normal = normalize(texelFetch(texture3,ivec2(texcoord*buffersize),0).xyz * 2.0f - 1.0f);

     

    also Leadwerks assign depth,diffuse,normals to texture0,1,2 default, so you don't really need a lua for the assigning if you use them in this order smile.png

    • Upvote 1
  4. Quick and dirty snow filter for the tournament (post effect):

     

    #version 400
    
    uniform sampler2DMS texture0;
    uniform sampler2D texture1;
    uniform sampler2DMS texture2;
    
    uniform bool isbackbuffer;
    uniform vec2 buffersize;
    
    uniform mat4 projectioncameramatrix;
    uniform vec3 cameraposition;
    uniform mat3 cameranormalmatrix;
    
    
    out vec4 fragData0;
    
    
    void main(void)
    {
       vec2 icoord = vec2(gl_FragCoord.xy/buffersize);
       if (isbackbuffer) icoord.y = 1.0f - icoord.y;
    
       vec4 color = texture(texture1,icoord);
       vec3 normalView = normalize(texelFetch(texture2, ivec2(icoord*buffersize),0).xyz * 2.0f - 1.0f);
       normalView = normalize(cameranormalmatrix*normalView);
    
       float cdepth = texelFetch(texture0, ivec2(icoord.xy*buffersize),0).r;
       if (cdepth<1 && normalView.y < .999 ) {
           color.rgb=mix(color.rgb,vec3(1,1,1.2),clamp(pow(normalView.y,8),0,1));
       }
    
       fragData0 = color;
    }
    
    
    
    

    post-747-0-21149000-1452976999_thumb.jpg

    • Upvote 13
×
×
  • Create New...