Jump to content

shadmar

Members
  • Posts

    3,618
  • Joined

  • Last visited

Posts posted by shadmar

  1. Here are 2 gamma correction postprocess shaders you can try:

    #define GAMMA 2.2
    vec3 gamma(vec3 col, float g)
    {
        float i = 1. / g;
        return vec3(pow(col.x, i)
                  , pow(col.y, i)
                  , pow(col.z, i));
    }
    
    fragData0.rgb=gamma(fragData0.rgb, GAMMA);

    or the cheapest one, looks like the one above but with no adustments to gamma.

    fragData0.rgb = sqrt(fragData0.rgb);

     

  2. float slope = 1.0-ex_normal.y;
    vec4 g1=texture(texture0,ex_texcoords0*42);
    vec4 g2=texture(texture1,ex_texcoords0*42);
    vec4 g3=texture(texture2,ex_texcoords0*42);
    vec4 g4=texture(texture3,ex_texcoords0*42);
    vec4 g1full=texture(texture0,ex_texcoords0);
    vec4 g2full=texture(texture1,ex_texcoords0);
    vec4 g3full=texture(texture2,ex_texcoords0);
    vec4 g4full=texture(texture3,ex_texcoords0);
    g1=mix(g1,g1full,0.2);
    g2=mix(g2,g2full,0.2);
    g3=mix(g3,g3full,0.2);
    g4=mix(g4,g4full,0.2);
    outcolor = g1;
    outcolor = mix(outcolor,g2,smoothstep(0.0,0.05,slope));
    outcolor = mix(outcolor,g3,smoothstep(0.01,0.125,slope));
    outcolor = mix(outcolor,g4,smoothstep(0.125,0.26,slope));
    

  3. Not sure you can allocate 13 channels? (4 diffuse, 4 normal, 4 specular + 1 for alpha), can't test right now.

    Might work if you pack specular into the alpha channel of the normal texture, then you would need only 9. (4 color, 4 normal with specular as alpha) + one mask alpha.

  4. This has been asked before, and I don't think you can change by code.

    But for workaround I think you can do one of these:

     

    1. add an invisible csg box and set it as parent to the model. (not enteirly sure, cant test this atm)

    2 .add 8 single verts representing your aabb in the modeler and resave, no faces needed.

    • Upvote 1
  5. Hi

     

    We have day and night cycle going in our game, and when the sun is getting really low, the shadows covers vast areas massivly increasing batch count and polycount and we get a huge amount of fps drop, 50%

     

    Is there a way to set shadow-range on low angles?

    Turning shadows off on low sunset/rise is very intrusive visually.

     

    Here you can see the difference on middle of the day, and just before the sun sets.

    Same scene, but light angle is different:

    post-747-0-00952500-1485681366_thumb.jpg

    post-747-0-60849800-1485681377_thumb.jpg

    • Upvote 1
×
×
  • Create New...