# cod1

Member

3

110 Neutral

• Rank
Newbie
1. ## Interval mapping problem

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; }
2. ## Relief mapping on terrain issue

ok I solved it, here's a demo http://dl.dropbox.com/u/91501658/POM/WebPlayer/WebPlayer.html however I still need to compute ray distance in order to create a LOD system and reduce impact on the gpu PS have u got any suggestion to calculate occlusion?
3. ## Relief mapping on terrain issue

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 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