Page MenuHome

Implementation of specular transparency property in GLSL render

Authored by Dontsov Valentin (valentin_b4w) on Sep 9 2014, 3:43 PM.



When object is transparent, modelers find it important to show specular shading with specular transparency. Current GLSL shading model doesn't support it yet. This diff fixes this issue.



Best regards,
Valentin. Blend4Web Team.

Diff Detail

rB Blender

Event Timeline

Dontsov Valentin (valentin_b4w) retitled this revision from to Implementation of specular transparency property in GLSL render.
Dontsov Valentin (valentin_b4w) updated this object.
Dontsov Valentin (valentin_b4w) set the repository for this revision to rB Blender.
Brecht Van Lommel (brecht) requested changes to this revision.Sep 10 2014, 1:26 AM
Brecht Van Lommel (brecht) edited edge metadata.
Brecht Van Lommel (brecht) added inline comments.

You can optimize this so that the alpha_spec_correction function call is only generated when needed, like e.g. this code.

if (GPU_link_changed(shi->spec) || ma->spec != 0.0f)
    GPU_link(mat, "shade_add", shr->combined, shr->spec, &shr->combined);

This code is not in the right place, now it will be executed for every lamp, but it should be only executed once afterwards, same as in shadeoutput.c.

    /* ambient color */
    if (world->ambr!=0.0f || world->ambg!=0.0f || world->ambb!=0.0f) {
        if (GPU_link_changed(shi->amb) || ma->amb != 0.0f)
            GPU_link(mat, "shade_maddf", shr->combined, GPU_uniform(&ma->amb),
                GPU_uniform(&world->ambr), &shr->combined);

// >>> do it here <<<

if (ma->mode & MA_RAMP_COL) ramp_diffuse_result(shi, &shr->combined);
if (ma->mode & MA_RAMP_SPEC) ramp_spec_result(shi, &shr->spec);
This revision now requires changes to proceed.Sep 10 2014, 1:26 AM
Dontsov Valentin (valentin_b4w) edited edge metadata.

Moved part of code to the right place. Added optimizing condition.

Brecht Van Lommel (brecht) edited edge metadata.

Looks good to me.

I or someone else can commit this once master is open again for new features, in about 2-3 weeks from now according to the schedule:

This revision is now accepted and ready to land.Sep 11 2014, 12:24 AM
Dontsov Valentin (valentin_b4w) edited edge metadata.

Update for the actual master.

This revision was automatically updated to reflect the committed changes.