Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#Actualgboxentertainment

Posted 22 July 2013 - 07:28 AM

So I've tried to raymarch an sdf texture of the stanford bunny from this website:

http://www.postronic.org/h3/test/webgl/ds09/

 

This is what it comes out as (I haven't rendered the bunny itself, just the shadow effect from it - its actually near the centre):

 

[attachment=16933:givoxshadows7.jpg]

float sdf(vec3 p) {
	float res = 32;
	float zFrame = floor(p.z*res);
	float v1 = texture2D(volTex, vec2(p.x, (p.y*0.5+zFrame)/res)).r;
	return v1;
}

float rm_bunny(in vec3 p)
{
	vec3 p2 = p;
	p2 += vec3(0,0,0); p2.z = -p2.z + 1.0;
	p2.x = min(1.0,max(0.0,p2.x));
	p2.y = min(1.0,max(0.0,p2.y));
	p2.z = min(1.0,max(0.0,p2.z));
	bunny = (0.5-sdf(p2))*0.3;

	return bunny;
}

I admit that most of this code was copied from that website and modified slightly without my complete understanding of it.

I just want to figure out how to minimize the noise adjacent to the shadow - it is a symptom of the softness of the penumbra.

 

Also, I don't know what's causing the gap between the bunny shadow and the other object shadows - I'm using min(rm_bunny(p),min(cube, sphere));

Its not to do with the raymarching steps because the gaps are still there even when using 500 steps.


#1gboxentertainment

Posted 22 July 2013 - 07:26 AM

So I've tried to raymarch an sdf texture of the stanford bunny from this website:

http://www.postronic.org/h3/test/webgl/ds09/

 

This is what it comes out as (I haven't rendered the bunny itself, just the shadow effect from it - its actually near the centre):

 

[attachment=16933:givoxshadows7.jpg]

float sdf(vec3 p) {
	float res = 32;
	float zFrame = floor(p.z*res);
	float v1 = texture2D(volTex, vec2(p.x, (p.y*0.5+zFrame)/res)).r;
	return v1;
}

float rm_bunny(in vec3 p)
{
	vec3 p2 = p;
	p2 += vec3(0,0,0); p2.z = -p2.z + 1.0;
	p2.x = min(1.0,max(0.0,p2.x));
	p2.y = min(1.0,max(0.0,p2.y));
	p2.z = min(1.0,max(0.0,p2.z));
	bunny = (0.5-sdf(p2))*0.3;

	return bunny;
}

I admit that most of this code was copied from that website and modified slightly without my complete understanding of it.

I just want to figure out how to minimize the noise adjacent to the shadow - it is a symptom of the softness of the penumbra.


PARTNERS