How to make quare tiles look less squarish?

Started by
4 comments, last by NickUdell 11 years, 11 months ago
I am making a terrain for my game and it uses tiledata(a grid of squares and the terrain type of each square),but it looks very squarish,even when I try to blur it on the blendmap:

[attachment=9041:terrain.png]

Is there a way to make the tiles be some other shape than a square?At most I managed to make them a little more circlish,using trigonometric functions,but all those operations just for the terrain diffuse color......
Advertisement
Had the same problem with my terrain generator. Got awesome results with texture blending:

Render all textures on every polygon.
For each texture on each vertex, assign an alpha value. (Render multiple textures over each other)

The tricky part:
For a given vertex compute all textures around it (four squares touching the vertex).
The alpha value should be the weighted average of the materials.

Example:
Givven a quad of Grass (G) and Rock( R ) Snow(S) in the following formation:
GG
RG

The vertex in the middle should have 0.75 grass , 0.25 rock, and no snow.



Hope this helps.

My Oculus Rift Game: RaiderV

My Android VR games: Time-Rider& Dozer Driver

My browser game: Vitrage - A game of stained glass

My android games : Enemies of the Crown & Killer Bees


Had the same problem with my terrain generator. Got awesome results with texture blending:

Render all textures on every polygon.
For each texture on each vertex, assign an alpha value. (Render multiple textures over each other)

The tricky part:
For a given vertex compute all textures around it (four squares touching the vertex).
The alpha value should be the weighted average of the materials.

Example:
Givven a quad of Grass (G) and Rock( R ) Snow(S) in the following formation:
GG
RG

The vertex in the middle should have 0.75 grass , 0.25 rock, and no snow.

quest.jpg?attachauth=ANoY7comBj8eeAd7gu5gMylmUbykjkPpaguVIpmBiT9zWxrvI97qZgPkYp-o1_imRyzPL3AoP0wDkgQjTBwHLUxbJHuCPTDKiiQMkQJAyVnyMa9B4mB03oXpn3IYypQyTiwENJHXKTzvGX_MZ7U-v01MxtYPjV7MPxhogqiNIBx7bzGW7SysANrn9wJvqBuBFIi4Bqshkjd4xP2PQcmuAZyf_ND8PBrP6A%3D%3D&attredirects=0

Hope this helps.

Had the same problem with my terrain generator. Got awesome results with texture blending:

Render all textures on every polygon.
For each texture on each vertex, assign an alpha value. (Render multiple textures over each other)

The tricky part:
For a given vertex compute all textures around it (four squares touching the vertex).
The alpha value should be the weighted average of the materials.

Example:
Givven a quad of Grass (G) and Rock( R ) Snow(S) in the following formation:
GG
RG

The vertex in the middle should have 0.75 grass , 0.25 rock, and no snow.

quest.jpg?attachauth=ANoY7comBj8eeAd7gu5gMylmUbykjkPpaguVIpmBiT9zWxrvI97qZgPkYp-o1_imRyzPL3AoP0wDkgQjTBwHLUxbJHuCPTDKiiQMkQJAyVnyMa9B4mB03oXpn3IYypQyTiwENJHXKTzvGX_MZ7U-v01MxtYPjV7MPxhogqiNIBx7bzGW7SysANrn9wJvqBuBFIi4Bqshkjd4xP2PQcmuAZyf_ND8PBrP6A%3D%3D&attredirects=0

Hope this helps.


wait I'm kind of confused,isn't the blending done in pixel shader?You mentioned vertex.I might have not understood properly,the image you linked is not displaying for some reason
Actually did this way before shader languages. I think it was with DirectX7 on a Geforce 2. So it was good old fixed pipeline (No shaders... ) . It doesn't matter. I had square terrain tiles (Easy for calculations) , and needed to remove the ugly square effect for rendering.

Fact of the matter is that for rendering it is better to assign material to vertex then to assign to square.

When you render a triangle, render it several times with different textures (fixed pipeline). Or render it once with several textures (HLSL pixel shader). The outcome is the same.


[background=rgb(250, 251, 252)]Example:[/background]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]Givven a quad of Grass (G) and Rock( R ) Snow(S) in the following formation:[/background][/font]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]GG[/background][/font]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]RG[/background][/font]



[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(247, 247, 247)]The vertex in the middle should have 0.75 grass , 0.25 rock, and no snow.[/background][/font]



[/quote]

Use the above mentioned "algorithm" to calculate the alpha value for that vertex and texture

Here is an example of the result. Although terrain tiles are square, you cannot see them (besides the fact that I used a very repetitive texture here).

My Oculus Rift Game: RaiderV

My Android VR games: Time-Rider& Dozer Driver

My browser game: Vitrage - A game of stained glass

My android games : Enemies of the Crown & Killer Bees


Actually did this way before shader languages. I think it was with DirectX7 on a Geforce 2. So it was good old fixed pipeline (No shaders... ) . It doesn't matter. I had square terrain tiles (Easy for calculations) , and needed to remove the ugly square effect for rendering.

Fact of the matter is that for rendering it is better to assign material to vertex then to assign to square.

When you render a triangle, render it several times with different textures (fixed pipeline). Or render it once with several textures (HLSL pixel shader). The outcome is the same.


[background=rgb(250, 251, 252)]Example:[/background]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]Givven a quad of Grass (G) and Rock( R ) Snow(S) in the following formation:[/background][/font]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]GG[/background][/font]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]RG[/background][/font]



[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(247, 247, 247)]The vertex in the middle should have 0.75 grass , 0.25 rock, and no snow.[/background][/font]





Use the above mentioned "algorithm" to calculate the alpha value for that vertex and texture

Here is an example of the result. Although terrain tiles are square, you cannot see them (besides the fact that I used a very repetitive texture here).
[/quote]


Actually did this way before shader languages. I think it was with DirectX7 on a Geforce 2. So it was good old fixed pipeline (No shaders... ) . It doesn't matter. I had square terrain tiles (Easy for calculations) , and needed to remove the ugly square effect for rendering.

Fact of the matter is that for rendering it is better to assign material to vertex then to assign to square.

When you render a triangle, render it several times with different textures (fixed pipeline). Or render it once with several textures (HLSL pixel shader). The outcome is the same.


[background=rgb(250, 251, 252)]Example:[/background]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]Givven a quad of Grass (G) and Rock( R ) Snow(S) in the following formation:[/background][/font]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]GG[/background][/font]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]RG[/background][/font]



[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(247, 247, 247)]The vertex in the middle should have 0.75 grass , 0.25 rock, and no snow.[/background][/font]





Use the above mentioned "algorithm" to calculate the alpha value for that vertex and texture

Here is an example of the result. Although terrain tiles are square, you cannot see them (besides the fact that I used a very repetitive texture here).
[/quote]


ok just one last question - can you post a single-line example of ''setting the vertex to 0.75 grass''? I mean I'm new with HLSL and so far all I've done is the standart RGB blendmap with 3 textures in pixel shader.

It'd be something like this (I'd personally do it in a pixel shader, as then you can perturb the boundaries with some noise to make it more natural and give you even more detail):

float rockPercentage = 0.25 //amount to go for rock
float grassPercentage = 0.75 //amount to go for grass
float snowPercentage = 0 //amount to go for snow

float4 snow = snowTex.Sample(texcoords); //the pixel colour of the snow texture
float4 grass = grassTex.Sample(texcoords); //the pixel colour of the grass texture
float4 rock = rockTex.Sample(texcoords); // the pixel colour of the rock texture

float4 colour = snow * snowPercentage + rock * rockPercentage + grass * grassPercentage;


Then the pixel colour will be 0% snow, 25% rock and 75% grass.

Do the same with the normal maps for a nice blend of those too.

EDIT: commented it up
Sole Creator of Pigment - a procedural, block-base space trading sim.

PhD student working on medical imaging at the University of Southampton.

Enjoyer of games, films, books and cider.

This topic is closed to new replies.

Advertisement