Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Apr 2012
Offline Last Active Oct 26 2014 03:42 PM

Posts I've Made

In Topic: Xbox One dev. language and engine etc?

27 August 2013 - 01:22 PM

I heard Xbox One will support Unity. So there's that. 

In Topic: Calculating Vertex Normals

11 June 2013 - 09:52 AM

I improved the averaging of vertex normals. I just need to improve the speed of it and chunk seams. 



In Topic: Calculating Vertex Normals

11 June 2013 - 09:26 AM

After reading the source code. It seems like they are just sampling the normals from a raw file.

So I'm not sure how to translate that into perlin noise code.

        private Vector3 SmoothNormal(Vector3 position)
            float dxz = 1.0f / 16.0f;
            float dy = 1.0f / 64.0f;
            Vector3 grad = Vector3.zero;

            grad.x = PerlinNoise.Noise(position.x + dxz, position.y, position.z) - PerlinNoise.Noise(position.x - dxz, position.y, position.z);
            grad.y = PerlinNoise.Noise(position.x, position.y + dy, position.z) - PerlinNoise.Noise(position.x, position.y - dy, position.z);
            grad.z = PerlinNoise.Noise(position.x, position.y, position.z + dxz) - PerlinNoise.Noise(position.x, position.y, position.z - dxz);

            return grad *= -1;

position is the vertex position

In Topic: Calculating Vertex Normals

10 June 2013 - 03:55 PM

Cool thanks. 


My next question is this line

float d = 1.0/(float)voxels_per_block;

What's the voxels per block variable? And does the noise generator have to be anything like what I used for generator the scalar field?

In Topic: Calculating Vertex Normals

10 June 2013 - 11:52 AM

I have it somewhat working. However, doing it this way is a lot slower. 


            for each vertex v in vertex list
                Vector3 n = Vector3.Zero 
                for each triangle t that shares v's vertex 
                    n += Normalize(v+ t.normal)  
                v.normal = Normalize(n)