Jump to content

[SOLVED] wrap, clamp and co for decals


photo

Recommended Posts

Hello, an addition to the decals would be a clear understanding of the wrapping, clamping etc. of the different textures. Atm it seems, that the decals, deferred and the terrain (base textures) are not able to use a tiled, clamped, wrapped etc. method for the textures. Doing a vec4(2.0f,2.0f,0.0f,0.0f) scales the textures correctly, but the image is always cut (perfecly clamped). Putting a multiplier for the texturecoordinates in the shader itself seems to work, as a quick test shows. The q. is where to start, implementing a 'tiling' method, which works. Best. W.

Link to comment

I think it comes from line 94 from fragment_deferred_sample.h (in 2013-04-30 sdk version, in the modified file provided in this thead https://developer.unigine.com/forum/topic/2027-terrain-decal-and-deferred-decal-ignores-normals-of-terrain/ it is line 105) where every pixel of the decal which has texture coordinates outside the [0,1] range is discarded.

Moving the line (102 in the modified fragment_deferred_sample.h) where the texture coordinates are transformed by the base_transform further down the file, after line 105 and before the diffuse, normal and specular textures are sampled,  seems to help.

I should mention that I didn't dig through the internals of texture2DAlpha() and texture2DNormal() in order to check if anything relies on that the texture coordinates are in [0,1] range.

 

Cheers

 Helmut

Link to comment
×
×
  • Create New...