Jump to content

[SOLVED] Problem with alpha channel in object terrain


photo

Recommended Posts

I've created a world with a object terrain. The problem is in the far distance, doesn't work the transparent texture. Only seen when the LOD's are loaded, in the near distance.

I've tried different combinations of materials, dds and png's with transparency but with the same result.

In the pictures you can see far distances in the ground does not load texture transparency. Up close, when the LOD's are loaded any problem.

Thanks in advanced

post-1322-0-14776100-1401693197_thumb.png

post-1322-0-90204500-1401693198_thumb.png

Link to comment

Is there any technical reason for that? We had the same issue but in our case we were able to get transparent terrain working with only minor changes to a couple of the default terrain shaders. Perhaps it could officially be supported?

 

We use transparency for areas where we have no terrain, and for areas where we want to view both the terrain surface (semi-transparent) and underground data.

Link to comment

We're using an older SDK, but I *think* it's mainly just a case of changing instances of

 

s_frag_color = half4(color * s_light_color.xyz,1.0f);

 

to 

 

s_frag_color = half4(color * s_light_color.xyz, diffuse.w);

 

i.e. use the alpha channel instead of 1.0f for the fragment color in terrain\fragment_base_*.shader (depending on which shader passes you're using - for us it was just light_world and ambient)

 

You might also need to change your terrain material blending options to whatever is most appropriate (e.g. <blend src="src_alpha" dest="one_minus_src_alpha"/>)

 

Not sure why it forces alpha to 1.0 by default but there is probably a reason... Unigine crew?

Link to comment

Working!

Many thanks Steve.

 

Not sure why it forces alpha to 1.0 by default but there is probably a reason... Unigine crew?

I want to know too :)

Link to comment
×
×
  • Create New...