Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualFlicklizic

Posted 09 June 2013 - 06:47 PM

Hello, I'm in doubt about which method should I use to render my terrain.

 

First, some information about my terrain style:

 

 - My game came is like Diablo, torchlight type so I dont need to worry about LOD or anything like it.

 - Currently I divide my terrain into 9 parts, each part is divided using a quad tree, rendering only what I can see.

 - Im using a 128x128 heightmap for each terrain which occupies an area of ​​64 game units.

 - Each terrain has it own textures, up to 8, and 2 alpha maps (so I can "paint" the map).

 

So, these are the methods that I thought:

 

1) Store only the texture info, the heightmap and the 2 alphamaps, calculate all the other things at the runtime only when that terrain is needed. Store this data and sent it to the shaders when the render time comes.

 

2) Pré calculate anything on the "building" phase and store ALL data, when that terrain is needed, just load the data and send to the shaders.

 

3) Store the texture info, the heightmap, a pre baked normal map texture and the alphamaps, when render comes send ONLY the textures, on the shader, do something like this:

 

 - Calculate the position using the index, for a 128x128 heightmap will be like this:

// PRIMITIVE_INDEX is the primitive index provided by the shader (I dont remember the semantic now)

uint COUNTER = 0; // Global

-----------------------------------------
uint xPos;
uint yPos;
uint zPos;
uint currentX;
uint currentZ;

currentX = PRIMITIVE_INDEX%128;
currentZ = PRIMITIVE_INDEX/128;

if(COUNTER == 3)
{
   COUNTER = 0;
}

if(COUNTER == 0)
{
   xPos = currentX/2;
   zPos = currentZ/2;
   yPos = TextureLookUp(currentX, currentZ);
}
else if(COUNTER == 1)
{
   xPos = currentX/2 + 0.5;
   zPos = currentZ/2;
   yPos = TextureLookUp(currentX, currentZ);
}
else
{
   xPos = currentX/2;
   zPos = currentZ/2 + 0.5;
   yPos = TextureLookUp(currentX, currentZ);
}

COUNTER++;

 

 - Compute the normals using the normal texture (same idea that I used for the position, the normal texture NOT the same texture for the pixel shader, this is a pre baked VERTEX normal texture)

 

 - Compute the texture coordinates using the positions.

 

 - Compute the tangent and binormal using more texture lookups.

 

Currently Im using the first ideia, but my fps is at 30~20 and I need to improve this (ok, my GPU is not that good, but I can play SC2 normally and Im only rendering the terrain).

 

 

 

Sorry for my bad english.


#5Flicklizic

Posted 09 June 2013 - 06:46 PM

Hello, I'm in doubt about which method should I use to render my terrain.

 

First, some information about my terrain style:

 

 - My game came is like Diablo, torchlight type so I dont need to worry about LOD or anything like it.

 - Currently I divide my terrain into 9 parts, each part is divided using a quad tree, rendering only what I can see.

 - Im using a 128x128 heightmap for each terrain which occupies an area of ​​64 game units.

 - Each terrain has it own textures, up to 8, and 2 alpha maps (so I can "paint" the map).

 

So, these are the methods that I thought:

 

1) Store only the texture info, the heightmap and the 2 alphamaps, calculate all the other things at the runtime only when that terrain is needed. Store this data and sent it to the shaders when the render time comes.

 

2) Pré calculate anything on the "building" phase and store ALL data, when that terrain is needed, just load the data and send to the shaders.

 

3) Store the texture info, the heightmap, a pre baked normal map texture and the alphamaps, when render comes send ONLY the textures, on the shader, do something like this:

 

 - Calculate the position using the index, for a 128x128 heightmap will be like this:

// PRIMITIVE_INDEX is the primitive index provided by the shader (I dont remember the semantic now)

uint COUNTER = 0; // Global

-----------------------------------------
uint xPos;
uint yPos;
uint zPos;
uint currentX;
uint currentZ;

currentX = PRIMITIVE_INDEX%128;
currentZ = PRIMITIVE_INDEX/128;

if(COUNTER == 3)
{
   COUNTER = 0;
}

if(COUNTER == 0)
{
   xPos = currentX;
   zPos = currentZ;
   yPos = TextureLookUp(currentX, currentZ);
}
else if(COUNTER == 1)
{
   xPos = currentX + 0.5;
   zPos = currentZ;
   yPos = TextureLookUp(currentX, currentZ);
}
else
{
   xPos = currentX;
   zPos = currentZ + 0.5;
   yPos = TextureLookUp(currentX, currentZ);
}

COUNTER++;

 

 - Compute the normals using the normal texture (same idea that I used for the position, the normal texture NOT the same texture for the pixel shader, this is a pre baked VERTEX normal texture)

 

 - Compute the texture coordinates using the positions.

 

 - Compute the tangent and binormal using more texture lookups.

 

Currently Im using the first ideia, but my fps is at 30~20 and I need to improve this (ok, my GPU is not that good, but I can play SC2 normally and Im only rendering the terrain).

 

 

 

Sorry for my bad english.


#4Flicklizic

Posted 09 June 2013 - 06:39 PM

Hello, I'm in doubt about which method should I use to render my terrain.

 

First, some information about my terrain style:

 

 - My game came is like Diablo, torchlight type so I dont need to worry about LOD or anything like it.

 - Currently I divide my terrain into 9 parts, each part is divided using a quad tree, rendering only what I can see.

 - Im using a 128x128 heightmap for each terrain which occupies an area of ​​64 game units.

 - Each terrain has it own textures, up to 8, and 2 alpha maps (so I can "paint" the map).

 

So, these are the methods that I thought:

 

1) Store only the texture info, the heightmap and the 2 alphamaps, calculate all the other things at the runtime only when that terrain is needed. Store this data and sent it to the shaders when the render time comes.

 

2) Pré calculate anything on the "building" phase and store ALL data, when that terrain is needed, just load the data and send to the shaders.

 

3) Store the texture info, the heightmap, a pre baked normal map texture and the alphamaps, when render comes send ONLY the textures, on the shader, do something like this:

 

 - Calculate the position using the index, for a 128x128 heightmap will be like this:

Vert1:

 x = 0;
 y = heightmap lookup;
 z = 0;

Vert2:

 x = 0.5;
 y = heightmap lookup;
 z = 0;

Vert3:

 x = 0;
 y = heightmap lookup;
 z = 0.5;

 

 - Compute the normals using the normal texture (same idea that I used for the position, the normal texture NOT the same texture for the pixel shader, this is a pre baked VERTEX normal texture)

 

 - Compute the texture coordinates using the positions.

 

 - Compute the tangent and binormal using more texture lookups.

 

Currently Im using the first ideia, but my fps is at 30~20 and I need to improve this (ok, my GPU is not that good, but I can play SC2 normally and Im only rendering the terrain).

 

 

 

Sorry for my bad english.


#3Flicklizic

Posted 09 June 2013 - 06:32 PM

Hello, I'm in doubt about which method should I use to render my terrain.

 

First, some information about my terrain style:

 

 - My game came is like Diablo, torchlight type so I dont need to worry about LOD or anything like it.

 - Currently I divide my terrain into 9 parts, each part is divided using a quad tree, rendering only what I can see.

 - Im using a 128x128 heightmap for each terrain which occupies an area of ​​64 game units.

 - Each terrain has it own textures, up to 8, and 2 alpha maps (so I can "paint" the map).

 

So, these are the methods that I thought:

 

1) Store only the texture info, the heightmap and the 2 alphamaps, calculate all the other things at the runtime only when that terrain is needed. Store this data and sent it to the shaders when the render time comes.

 

2) Pré calculate anything on the "building" phase and store ALL data, when that terrain is needed, just load the data and send to the shaders.

 

3) Store the texture info, the heightmap, a pre baked normal map texture and the alphamaps, when render comes send ONLY the textures, on the shader, do something like this:

 

 - Calculate the position using the index, for a 128x128 heightmap will be like this:

Vert1:

 x = 0;
 y = heightmap lookup;
 z = 0;

Vert2:

 x = 0.5;
 y = heightmap lookup;
 z = 0;

Vert3:

 x = 0;
 y = heightmap lookup;
 z = 0.5;

 

 - Compute the normals using the normal texture (same idea that I used for the position, the normal texture NOT the same texture for the pixel shader, this is a pre baked VERTEX normal texture)

 

 - Compute the texture coordinates using the positions.

 

 - Compute the tangent and binormal using more texture lookups.

 

Currently Im using the first ideia, but my fps is at 30~20 and I need to improve this (ok, my GPU is not that good, but I can play SC2 normally and Im only rendering the terrain).

 

 

 

Sorry for mu bad english.


#2Flicklizic

Posted 09 June 2013 - 06:31 PM

Hello, I'm in doubt about which method should I use to render my terrain.

 

First, some information about my terrain style:

 

 - My game came is like Diablo, torchlight type so I dont need to worry about LOD or anything like it.

 - Currently I divide my terrain into 9 parts, each part is divided using a quad tree, rendering only what I can see.

 - Im using a 128x128 heightmap for each terrain which occupies an area of ​​64 game units.

 - Each terrain has it own textures, up to 8, and 2 alpha maps (so I can "paint" the map).

 

So, these are the methods that I thought:

 

1) Store only the texture info, the heightmap and the 2 alphamaps, calculate all the other things at the runtime only when that terrain is needed. Store this data and sent it to the shaders when the render time comes.

 

2) Pré calculate anything on the "building" phase and store ALL data, when that terrain is needed, just load the data and send to the shaders.

 

3) Store the texture info, the heightmap, a pre baked normal map texture and the alphamaps, when render comes send ONLY the textures, on the shader, do something like this:

 

 - Calculate the position using the index, for a 128x128 heightmap will be like this:

xPos = VERT_INDEX

Vert1:

 x = 0;
 y = heightmap lookup;
 z = 0;

Vert2:

 x = 0.5;
 y = heightmap lookup;
 z = 0;

Vert3:

 x = 0;
 y = heightmap lookup;
 z = 0.5;

 

 - Compute the normals using the normal texture (same idea that I used for the position, the normal texture NOT the same texture for the pixel shader, this is a pre baked VERTEX normal texture)

 

 - Compute the texture coordinates using the positions.

 

 - Compute the tangent and binormal using more texture lookups.

 

Currently Im using the first ideia, but my fps is at 30~20 and I need to improve this (ok, my GPU is not that good, but I can play SC2 normally and Im only rendering the terrain).

 

 

 

Sorry for mu bad english.


#1Flicklizic

Posted 09 June 2013 - 06:29 PM

Hello, I'm in doubt about which method should I use to render my terrain.

 

First, some information about my terrain style:

 

 - My game came is like Diablo, torchlight type so I dont need to worry about LOD or anything like it.

 - Currently I divide my terrain into 9 parts, each part is divided using a quad tree, rendering only what I can see.

 - Im using a 128x128 heightmap for each terrain which occupies an area of ​​64 game units.

 - Each terrain has it own textures, up to 8, and 2 alpha maps (so I can "paint" the map).

 

So, these are the methods that I thought:

 

1) Store only the texture info, the heightmap and the 2 alphamaps, calculate all the other things at the runtime only when that terrain is needed. Store this data and sent it to the shaders when the render time comes.

 

2) Pré calculate anything on the "building" phase and store ALL data, when that terrain is needed, just load the data and sendo to the shaders.

 

3) Store the texture info, the heightmap, a pre baked normal map texture and the alphamaps, when render comes send ONLY the textures, on the shader, do something like this:

 

 - Calculate the position using the index, for a 128x128 heightmap will be like this:

Vert1:

 x = 0;
 y = heightmap lookup;
 z = 0;

Vert2:

 x = 0.5;
 y = heightmap lookup;
 z = 0;

Vert3:

 x = 0;
 y = heightmap lookup;
 z = 0;

 

 - Compute the normals using the normal texture (same idea that I used for the position, the normal texture NOT the same texture for the pixel shader, this is a pre baked VERTEX normal texture)

 

 - Compute the texture coordinates using the positions.

 

 - Compute the tangent and binormal using more texture lookups.

 

Currently Im using the first ideia, but my fps is at 30~20 and I need to improve this (ok, my GPU is not that good, but I can play SC2 normally and Im only rendering the terrain).

 

 

 

Sorry for mu bad english.


PARTNERS