Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I'm understanding you correctly, you'll need different texture coords for your mixmap. Right now it's using the the entire mixmap per cell which is why you get half text, half crate per cell.</p> <p>Try using multiple texcoords. You can also calculate the correct UV in the shader by having it by the current x pos of the vertex divided by the length of the terrain in the x direction and same for y. If you scale you're terrain though, be sure to multiply the length of the terrain by the scale as well.</p> <p>If you don't see what I'm saying, every cell of the terrain is getting UVs of either: (0,0), (1,0), (0,1), or (1,1). This is fine for the crate and text texture but the mixmap should be much more fractional and diverse.</p> <p>Here is a <a href="http://www.chadvernon.com/blog/resources/directx9/terrain-generation-with-a-heightmap/" rel="nofollow noreferrer">link</a> to another terrain tutorial. It uses DirectX, but the vertex/UV generation is comparable. The biggest difference is that he uses one big texture for the entire terrain which is what you need to be doing for your mixmap but not for your other textures.</p> <p>I think I figured out whats wrong. Store the Vertex position explicitly. Don't multiply it by the modelviewmatrix ie:</p> <pre><code>varying vec4 VertexPosition; void main() { gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = ftransform(); //VertexPosition = gl_ModelViewMatrix * gl_Vertex;; VertexPosition = gl_Vertex; } </code></pre> <p>This will fix it, sorry I threw your fixed shader into rendermonkey and it no longer moves with the camera. Hope this helps. I was getting the panning but now it looks like:</p> <p><img src="https://i.stack.imgur.com/SauIR.png" alt="Fixed render"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload