Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 27 Sep 2012
Offline Last Active Oct 02 2013 03:19 PM

Topics I've Started

Interval mapping problem

06 October 2012 - 04:18 PM

So I created a shader based on linear+binary steps, but I need to create a interval mapping shader. However I got strange articrafts and I don't know why, please help me

for( i=0;i<binarySearchSteps;i++ )
	 float line_slope = (bound_A.y-bound_B.y)/(bound_A.x-bound_B.x);
	 float line_inter = bound_A.y-(line_slope*bound_A.x);
	 float dem = (IN.viewDir.y/IN.viewDir.x)-line_slope;
	 float inter_pt = line_inter/dem;
	 float best_depth;
	 float tex_coords_offset2D = inter_pt*float2(IN.viewDir.y, -IN.viewDir.x);
	 float int_depth = (IN.viewDir.y/IN.viewDir.x)*inter_pt;
	 float pixel_color = tex2Dlod(_DispMap0, float4(tex_coords_offset2D+IN.uv_Splat0,0, 0)).a;
	 if (pixel_color<int_depth)//new upper Bound
	  bound_A.y = pixel_color;
	  bound_A.x = inter_pt;
	  best_depth = bound_A.y;
	 else // new lower bound
	  bound_B.y = pixel_color;
	  bound_B.x = inter_pt;
	  best_depth = bound_B.y;
	 tex_coords_offset2D = ((1.0f/(IN.viewDir.y/IN.viewDir.x))*best_depth)*float2(IN.viewDir.y,-IN.viewDir.x);
	 p.xy += tex_coords_offset2D;

Relief mapping on terrain issue

27 September 2012 - 12:08 PM

Hi all, I just started extending unity's terrain system in order to achieve a visual effect as the one of Cryengine 3. So, the point is that tessellation is too expensive, parallax mapping isn't so good, but I just met a article of FABIO POLICARPO, teaching me relief mapping. However it works greatly on flat and curve meshes, but on the terrain it looks like that

Posted Image

On the right u can see relief mapping applyed to a flat plane, while on the right u can see the same mapping applyed to the terrain. What's wrong with that? It just look as the texture twirls around the camera, and also while moving it looks a little ugly...

Thanks for your time and please could u also explain me interval mapping? Thanks again