• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
riuthamus

Water Style Direction

4 posts in this topic

I wanted to get some feedback on our water. I think our effect is really good but there is something about the reflections that seem off. Is there any special techniques we should be using to make the water look a bit.... better? I am already very pleased with the look but just wanted to see what else we could do, or if people thought we needed to do anything.

Our current "suspected issue" is that we have mip mapping working, this makes the water look smooth really far. If we remove the mip mapping the water looks like dancing ants in the background... is there any tech that would give us a nice inbetween look?

[img]http://www.bhslaughter.com/forum/uploads/gallery/album_371/gallery_1_371_423777.png[/img]

[img]http://www.bhslaughter.com/forum/uploads/gallery/album_371/gallery_1_371_14881.jpg[/img]

[img]http://www.bhslaughter.com/forum/uploads/gallery/album_371/gallery_1_371_27573.jpg[/img] Edited by riuthamus
0

Share this post


Link to post
Share on other sites
A few thoughts:
* Use anisotropic filtering.
* Reflected sky is much brighter than the actual sky at/near horizon.
* Add a shimmer effect (in water plane direction at distance sample reflection with noise offset) - it is too clean reflection.

Use 3D texture for noise using z as time - for stable and pleasant shimmer.
Use more samples with noise offsets than one (diverging from one point outward in response to anisotropy and distance [ignore anisotropy at small distance - looks silly]). Edited by tanzanite7
1

Share this post


Link to post
Share on other sites
we are playing with the idea of tessellation, but that will not come until we figure out how we are going to make dynamic water. Right now, the obvious issue is the mipmapping fucking with our normal maps for the water. We are trying to resolve that.
0

Share this post


Link to post
Share on other sites
I'm the one that coded the water. I think one of the problems is that the normal map is in tangent space but we dont have code for tangent space normals. Also, our game uses Y = up. I'm not sure how that affects the water shader. I had to change the sampled value order to .rbg just to get it to not look completely messed up. The specular reflections also seem wrong to me, they only occur near the middle of the water.

What were you suggesting to enable anisotropic filtering on? The reflections/refractions or the normal map?

The code is mostly the same as from [url=http://habibs.wordpress.com/lake/]this tutorial[/url]

[code]
float4x4 World;
float4x4 View;
float4x4 ReflectionView;
float4x4 Projection;
float3 CamPos;
float FarPlane;
float4 WaterColor;
float WaveLength;
float WaveHeight;
float Time;
float WindForce;
float3 WindDirection;
float3 LightDirection;
Texture2D ReflectionMap;
Texture2D RefractionMap;
Texture2D DepthMap;
Texture2D BumpMap1;
Texture2D BumpMap2;

//specular input variables
float SpecPerturb = 1;
float SpecPower = 354;

SamplerState RTSampler
{
Filter = Min_Mag_Mip_Linear;
AddressU = mirror;
AddressV = mirror;
};

SamplerState MapSampler
{
Filter = Min_Mag_Mip_Linear;
AddressU = Wrap;
AddressV = Wrap;
};

struct VertexShaderInput
{
float4 Position : POSITION0;
float3 Normal : NORMAL;
float2 TexCoords : TEXCOORD0;
};

struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 ReflectionMapSamplingPos : TEXCOORD0;
float2 BumpMapSamplingPos : TEXCOORD1;
float2 BumpMapSamplingPos2 : TEXCOORD2;
float4 RefractionMapSamplingPos : TEXCOORD3;
float4 Position3D : TEXCOORD4;
};

struct PixelShaderOutput
{
float4 Color : SV_TARGET0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output = (VertexShaderOutput)0;

float4x4 worldViewProjection = mul(World, mul(View, Projection));
float4x4 reflectionWorldViewProjection = mul(World, mul(ReflectionView, Projection));

float3 windDir = normalize(WindDirection);
float3 windDir2 = normalize(mul(WindDirection, float3x3(0.707, 0, -.707, 0, 1, 0, .707, 0, .707))); //45 degree rotation matrix
float3 perpDir = cross(windDir, float3(0, 1, 0));

float ydot = dot(input.TexCoords, windDir.xz);
float xdot = dot(input.TexCoords, perpDir.xz);
float2 moveVector = float2(xdot, ydot);
float2 moveVector2 = float2(dot(input.TexCoords, cross(windDir2, float3(0, 1, 0)).xz), dot(input.TexCoords, windDir2.xz));

moveVector.y += Time * WindForce;
moveVector2.y += Time * 2 * WindForce;

output.Position = mul(input.Position, worldViewProjection);
output.Position.z = log(0.001 * output.Position.z + 1) / log(0.001 * FarPlane + 1) * output.Position.w;
output.ReflectionMapSamplingPos = mul(input.Position, reflectionWorldViewProjection);
output.RefractionMapSamplingPos = output.Position;
output.Position3D = mul(input.Position, World);
output.BumpMapSamplingPos = moveVector / WaveLength;
output.BumpMapSamplingPos2 = moveVector2 / (WaveLength / 2);

//output.Depth.x = output.Position.z;
//output.Depth.y = output.Position.w;

return output;
}

PixelShaderOutput PixelShaderFunction(VertexShaderOutput input)
{
PixelShaderOutput output = (PixelShaderOutput)0;

float2 ProjectedTexCoords;
float2 ProjectedRefrTexCoords;
float3 BumpColor1 = BumpMap1.Sample(MapSampler, input.BumpMapSamplingPos).rgb;
float3 BumpColor2 = BumpMap1.Sample(MapSampler, input.BumpMapSamplingPos2).rgb;
//float3 BumpColor = float3(BumpColor1.xy + BumpColor2.xy, BumpColor1.z * BumpColor2.z);
float3 BumpColor = normalize(2 * (BumpColor1 + BumpColor2) - 2);

ProjectedTexCoords.x = input.ReflectionMapSamplingPos.x / input.ReflectionMapSamplingPos.w / 2.0f + 0.5f;
ProjectedTexCoords.y = -input.ReflectionMapSamplingPos.y / input.ReflectionMapSamplingPos.w / 2.0f + 0.5f;

ProjectedRefrTexCoords.x = input.RefractionMapSamplingPos.x / input.RefractionMapSamplingPos.w / 2.0f + 0.5f;
ProjectedRefrTexCoords.y = -input.RefractionMapSamplingPos.y / input.RefractionMapSamplingPos.w / 2.0f + 0.5f;

float2 perturbation = WaveHeight * (BumpColor);
float2 perturbatedTexCoords = ProjectedTexCoords + perturbation;
float2 perturbatedRefrTexCoords = ProjectedRefrTexCoords + perturbation;

float4 ReflectiveColor = ReflectionMap.Sample(RTSampler, perturbatedTexCoords);
float4 RefractiveColor = RefractionMap.Sample(RTSampler, perturbatedRefrTexCoords);

//output.Color = RefractiveColor;
//return output;
//clip(input.Depth.x / input.Depth.y - Depth);

float3 eyeVector = normalize(CamPos - input.Position3D);
float3 normalVector = (BumpColor.rbg);
float fresnelTerm = 0.02f+0.97f*pow((1-dot(eyeVector, normalVector)),5);
//float fresnelTerm = dot(eyeVector, normalVector);
//fresnelTerm = 1 - fresnelTerm * 1.3f;

float3 reflectionVector = -reflect(LightDirection, normalVector);
//float specular = dot(normalize(reflectionVector), normalize(eyeVector));

//specular = pow(specular, 256);


float4 specColor;
float3 lightSourceDir = normalize(-LightDirection);
//float3 lightSourceDir = normalize(float3(0.8f, 0.1f, 0.0f));
float3 halfvec = normalize(eyeVector + lightSourceDir + float3(perturbation.xy * SpecPerturb, 0));
float3 temp = 0;

temp.x = pow(dot(halfvec, normalVector), SpecPower);

specColor = float4(1, 1, 1, 1);
specColor *= temp.x;
specColor = float4(specColor.xyz * specColor.w, 0);


fresnelTerm = clamp(fresnelTerm, 0, 1);
//float4 combinedColor = lerp(ReflectiveColor, RefractiveColor, fresnelTerm);
float4 combinedColor = RefractiveColor * (1 - fresnelTerm) + ReflectiveColor * fresnelTerm;

output.Color = lerp(combinedColor, float4(WaterColor.rgb, 1), WaterColor.w) + specColor;
//output.Color = WaterColor;

return output;
//return float4(1,1,1,0.0);
}

technique11 Water
{
pass Pass1
{
SetVertexShader(CompileShader(vs_4_0, VertexShaderFunction()));
SetPixelShader(CompileShader(ps_4_0, PixelShaderFunction()));
}
}
[/code] Edited by Telanor
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0