Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

Wierdly diamond shaped terrain normals

$
0
0

I found a way to generate terrain normals on the fly. The problem is they have some wierd diamond shape to them that I cant quite figure out why. Below is the world normals:

This is the corresponding wireframe:

VertexOut vs_main(VertexIn input)
{
    const uint transformIndex = gTransformOffset + input.mInstanceID;
    // silly that we have to transpose this...
    const float4x4 worldTransform = transpose( gTerrainWorldTransforms.Load( transformIndex ) );
    const uint LODlevel = gTerrainLODLevels.Load( transformIndex );
    const float4 worldPos = mul( worldTransform, float4( input.mPosition, 1 ) );
    bool doMorphing = LODlevel > 0;

    float morphLerpK = 0.0f;
    float2 texcoord;
    float4 outWorldPos = worldPos;
    if ( doMorphing )
    {
        float4 preMorphPos = worldPos;
        float2 preMorphTexcoord = GetTextureCoordinates …

Viewing all articles
Browse latest Browse all 17560

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>