Jump to content

blurring the shadow with dist: how is it possible?


kensonuken

Recommended Posts

Im working on blur the shadow with distance.. but Im not getting the right blur increment with distance from the occluded object..

Im getting a constant blur all the shadow..

light
bspotlight(
	float intensity = 1;
	color lightcolor = 1;
	uniform string shadowmap = "";
	uniform float shadblur = 0;
	float dblur = 1;
	point from = point "shader" (0,0,0);
	point to = point "shader" (0,0,1);
	float coneangle = radians(30);
	float conedeltaangle = radians(5);
	float beamdistribution = 2;
	float decay = 2.0; 
	float __nondiffuse = 0, __nonspecular = 0; )
{
	uniform vector A = (to - from) / length(to - from);

	illuminate( from, A, coneangle ) 
	{
			float blur = shadblur * length(L) * dblur;
		color shad = shadow( shadowmap, Ps, "blur", blur );

		float distance_squared = L.L;
		float distance = sqrt( distance_squared );

		float cosangle = L.A / distance;

		float atten = pow(cosangle, beamdistribution);

		if( decay == 0.0 )
			/* do nothing */;
		else if( decay == 2.0 )
			atten /= distance_squared;
		else if( decay == 1.0 )
			atten /= distance;
		else
			atten /= pow(distance, decay);

		atten *=
			smoothstep( cos(coneangle),
				cos(coneangle - conedeltaangle), cosangle );

		Cl = atten * (1-shad) * intensity * lightcolor;
	}
}

Link to comment
Share on other sites

Are you talking about Mantra?

It should be possible to do this, but the last time I tried this (admittedly a couple of years ago) it didn't want to work which I had chalked up to a VEX varying variable problem before (I had striated artifacts in the shadows). I couldn't tell you why it's not working right now; I'd have to make tests in the shadow shader. Can you post an image results of a simple test?

PS, using a shadow shader is more convenient than a light shader as it allows you to reuse this shadowing with any light.

Link to comment
Share on other sites

Im thinking of using few shadow maps but with lower res to get the desired look rather than writing code but how fast or slow this would be is bothering me.... because anyway we want zero blur or very little blur at the beginning but as dist goes on the blur should increase and the one in 3db site is really good but onlything is that yeah.. its not fast as expected but at the same time it has artifacts with dsm...

Link to comment
Share on other sites

Im thinking of using few shadow maps but with lower res to get the desired look rather than writing code but how fast or slow this would be is bothering me.... because anyway we want zero blur or very little blur at the beginning but as dist goes on the blur should increase and the one in 3db site is really good but onlything is that yeah.. its not fast as expected but at the same time it has artifacts with dsm...

Would you mind posting image results of the artifacts?

You might not be aware of the "lerp" texture filtering option which may or may not reduce artifacts. It says this only works for the texture() VEX function but perhaps it works for shadowmap() too, but doubtful...

http://www.sidefx.com/docs/houdini9.5/vex/...xts#imagefilter

Link to comment
Share on other sites

http://www.filefactory.com/file/a00h4ff/n/...shadow_blur_tif

http://www.filefactory.com/file/a00h4a1/n/shadow_blur_rib

http://www.studioinverse.com/3db-site/down...ftShadowSpot.sl

m happy with the shadow blur getting changed by distance but im getting a broad blur overall in the shadow some sort of artifact.. what can that be?

Im getting some strange error when im increasing the bias cone it deminished a bit but couldnt eleminate

anyway to remove that?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...