Transparent models disappear in front of fx_mirrorWater shader.

Posted By: Henning

Transparent models disappear in front of fx_mirrorWater shader. - 07/06/11 14:45

Hi all,

I have a small island with palms (billboards) on it and fx_mirrorWater shader applied to the sea. When I compile it in WED and use it, some of the palms disappear when in front of the sea. See picture:
Image: rearmost palms disappear.

The same works with partly transparent models, just add the red parts to water.c from the samples folder of 3D Gamestudio installation and you will see the rearmost trees disappear:

function setTree () {
vec_fill (my.scale_x, 0.02);
vec_set (my.x, vector (random (400)-200, random (400)-200, -5));
set (me, TRANSLUCENT);
}

function main()
{
if (d3d_shaderversion<2020)
error("Shaders require Commercial Edition!");
d3d_antialias = 4;
video_mode = 8;
fps_max = 60;
// load a level, and create sky, water, and a model :
level_load("small.hmp");
ent_createlayer("skycube+6.dds",SKY | CUBE | SHOW,1);
ent_create("water.hmp",vector(0,0,-5),water);
ent_create("blob.mdl",vector(0,0,30),blob);
vec_set(sun_color,vector(200,240,240));

var i;
for (i=0; i<30; i++) {
ent_create("tree2.mdl",vector(0,0,-5),setTree);
}


Picture: model trees.
Does anybody know a solution?

Thx.
Posted By: rojart

Re: Transparent models disappear in front of fx_mirrorWater shader. - 07/08/11 13:49

That happens because you use the Transparent Rendering Process method (see the "'Transparency' is not what you think" subject) instead of Solid Pass Process.

Simply add the d3d_entsort = 0; to the main function or add the bool PASS_SOLID; flag in the mirrorWater.fx file.

Posted By: Henning

Re: Transparent models disappear in front of fx_mirrorWater shader. - 07/11/11 08:30

Thanks rojart,

d3d_entsort = 0 does the job. I looked everywhere, except for these 3d3 functions. Seems it is time to reread them.
The palms do not sort properly now in some cases as predicted, but that is a minor (not so visible) problem.

henning
© 2024 lite-C Forums