Fresnel shader help

I am looking to make a shader which fades out at the edge of the object.
Had a look at the plasma example and this changes emissive with material.chunks.emissiveConstPS = fs;
vec3 getEmission() ()

How would I do the same for the Diffuse Colour, so I can fade the Alpha with a dotproduct at the edge?

What does material.chunks.emissiveConstPS have to be for diffuse also does getEmission() needs to be renamed

Any idea would be welcome

Hi @rleinfellner,

You can find the original shader chunks here, so you can copy and further edit the shader code:

For the diffuse here is how you can override the default values for a simple material (no detail map):

    m.chunks.diffusePS = `
uniform vec3 material_diffuse;

uniform sampler2D texture_diffuseMap;

void getAlbedo() {
    dAlbedo = vec3(1.0);

    #ifdef MAPCOLOR
        dAlbedo *= material_diffuse.rgb;

    #ifdef MAPTEXTURE
        dAlbedo *= gammaCorrectInput(addAlbedoDetail(texture2D(texture_diffuseMap, $UV).$CH));

    #ifdef MAPVERTEX
        dAlbedo *= gammaCorrectInput(saturate(vVertexColor.$VC));
1 Like

Many thanks for this

Any idea why sqrt() is not defined, it should be a standard shader function

Ignore me its defined but editor does not know that

Look at engine source at github