Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualNickUdell

Posted 29 May 2012 - 06:36 AM

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

#2NickUdell

Posted 29 May 2012 - 06:34 AM

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 first item instead of second
float grassPercentage = 0.75 //amount to go for first item instead of second
float snowPercentage = 0 //amount to go for first item instead of second

float4 snow = snowTex.Sample(texcoords);
float4 grass = grassTex.Sample(texcoords);
float4 rock = rockTex.Sample(texcoords)

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: coded it up

#1NickUdell

Posted 29 May 2012 - 06:34 AM

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 first item instead of second
float grassPercentage = 0.75 //amount to go for first item instead of second
float snowPercentage = 0 //amount to go for first item instead of second

float4 snow = snowTex.Sample(texcoords);
float4 grass = grassTex.Sample(texcoords);
float4 rock = rockTex.Sample(texcoords)

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.

PARTNERS