Jump to content

Decals on Terrain


photo

Recommended Posts

Hello in our app using Unigine 1.0 version

 

We had a material for terrain overlay like this 

<material name="my_terrain_overlay" parent="decal_terrain_base">
<blend src="src_alpha" dest="one_minus_src_alpha"/>
<options offset="1" depth_mask="1" glow_mask="0" parallax_mask="0" alpha_test="1" cast_shadow="0"/>
<state name="deferred">0</state>
<state name="light_spot">0</state>
<state name="light_omni">0</state>
<state name="light_proj">0</state>
<state name="light_world">0</state>
<state name="auxiliary">0</state>
<parameter name="detail_0_transform">vec4(128.0f,128.0f,0.0f,0.0f)</parameter>
<parameter name="detail_1_transform">vec4(128.0f,128.0f,0.0f,0.0f)</parameter>
<parameter name="detail_0_diffuse">0.293</parameter>
<parameter name="detail_0_normal">0.277</parameter>
<parameter name="detail_1_value">0.216</parameter>
<parameter name="detail_1_threshold">0.353</parameter>
<parameter name="detail_1_diffuse">0.507</parameter>
<parameter name="detail_1_normal">0.373</parameter>
<parameter name="specular_scale">0</parameter> 
</material>
    
    To render an overlay image over terrain Which used to work fine
    Please note : To enable transparency in terrain we rendered terrain using Ambient Shader and same worked good with Overlay also
    
    
Now with Unigine 2.3.1
We have modified material for terrain  overly  as below (Need to delete unnecessary tags though)
 
<material name="my_terrain_overlay" parent="decal_base">
    <!-- textures -->
    <texture unit="0" name="albedo" anisotropy="1">core/textures/common/red.dds</texture>
    <texture unit="1" name="normal" anisotropy="1" format="signed">core/textures/common/normal.dds</texture>
    <texture unit="2" name="shading" water_decal="0" anisotropy="1">core/textures/common/red.dds</texture>
    <texture unit="4" name="detail_albedo" detail="1" anisotropy="1">core/textures/common/red.dds</texture>
    <texture unit="5" name="detail_shading" water_decal="0" detail="1" anisotropy="1">core/textures/common/red.dds</texture>
    <texture unit="6" name="detail_normal" detail="1" anisotropy="1" format="signed">core/textures/common/normal.dds</texture>
    <texture unit="7" name="parallax" parallax="1" anisotropy="1">core/textures/common/red.dds</texture>
    <blend src="src_alpha" dest="one_minus_src_alpha"/>
    <options offset="1" depth_mask="1" glow_mask="0" parallax_mask="0" alpha_test="1" cast_shadow="0"/>
    <state name="deferred">0</state>
    <state name="light_spot">0</state>
    <state name="light_omni">0</state>
    <state name="light_proj">0</state>
    <state name="light_world">0</state>
    <state name="auxiliary">0</state>
    <parameter name="detail_0_transform">vec4(128.0f,128.0f,0.0f,0.0f)</parameter>
    <parameter name="detail_1_transform">vec4(128.0f,128.0f,0.0f,0.0f)</parameter>
    <parameter name="detail_0_diffuse">0.293</parameter>
    <parameter name="detail_0_normal">0.277</parameter>
    <parameter name="detail_1_value">0.216</parameter>
    <parameter name="detail_1_threshold">0.353</parameter>
    <parameter name="detail_1_diffuse">0.507</parameter>
    <parameter name="detail_1_normal">0.373</parameter>
    <parameter name="specular_scale">0</parameter>
  </material>

Which works fine if the Terrain is rendered using deferred pass , but it fails with terrain rendered using forward pass in ambient shader.

 

Can you help ?

With Unigine 1 we were able to have overlay with terrain even if it was using ambient shaders ?

How we can achieve it in  Ungine2.3.1 ?

Link to comment

Hello

Even though it looked like overly using decal worked fine when we rendered terrain in deferred pass.

It has some issues. I reproduced them  using sample app 

samples\decals\proj_02.cpp

 

I have added the cube to sample app.

Please see the attached image "decal_demo" , where we can see that it is getting applied over cube not terrain.

How can we apply decal to terrain ? 

 

Thanks in advance

 

post-2605-0-80460800-1487923095_thumb.png

Link to comment

Akshay,

 

Decals are rendered correctly on the last screenshot. You put object above the terrain and decal uses GBuffer (opacity) to project onto the surface. Did you expect different results? 

 

If you can provide us a small test sample with your shader and requirements - our devs can take a look into it.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hello,

is there anyway we can render decal on terrain without interfering with that cube ?

 

In my first comment i have put a material for  "my_terrain_overlay"  in unigine 1.0 which inherits from  "decal_terrain_base",

 

"decal_terrain_base" is absent in unigine2.3.1 do we have any alternative ?

 

Also the terrain we have in our app is rendered in ambient shader , so we wont be filling the GBuffer in deffered pass and the decal functionality showin in demo app can not be used as it is in our app.

Need help

 

 

 

 

 

(Note the terrain we have in our app is rendered in ambient shader , so we wont be filling the GBuffer in deffered pass)

Link to comment

Thanks Werner ,  :) we will check how masks would be helpful .

 

@unigine support ,But we also need the decal functionality working when terrain is rendered using ambient shaders

Link to comment

Akshay,

 

Yes, I saw the question. Decals right now working only with deferred objects. Since your terrain is now rendered in forward path they will not work. Unfortunately, there is no easy to implement solution that will solve your issue (changes needs to be done as well on CPU and GPU (shaders) parts).

 

Maybe we can suggest you solution based on online training to get a better understanding of your requirements and needs.

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hello

Even though it looked like overly using decal worked fine when we rendered terrain in deferred pass.

It has some issues. I reproduced them  using sample app 

samples\decals\proj_02.cpp

 

I have added the cube to sample app.

Please see the attached image "decal_demo" , where we can see that it is getting applied over cube not terrain.

How can we apply decal to terrain ? 

 

Thanks in advance

 

Cube must have material which will not receive terrain decal (via mask).

  • Like 1
Link to comment
×
×
  • Create New...