kensonuken Posted January 4, 2009 Share Posted January 4, 2009 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; } } Quote Link to comment Share on other sites More sharing options...
Jason Posted January 4, 2009 Share Posted January 4, 2009 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. Quote Link to comment Share on other sites More sharing options...
symek Posted January 4, 2009 Share Posted January 4, 2009 We used to implement the code from 3db-site but results (at least for our try in VEX) were rather poor. Artifacts and not so fast as one would expect. Quote Link to comment Share on other sites More sharing options...
kensonuken Posted January 5, 2009 Author Share Posted January 5, 2009 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... Quote Link to comment Share on other sites More sharing options...
Jason Posted January 5, 2009 Share Posted January 5, 2009 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 Quote Link to comment Share on other sites More sharing options...
kensonuken Posted January 6, 2009 Author Share Posted January 6, 2009 have a look at this.. http://highend3d.com/maya/tutorials/render...ders/175-1.html http://highend3d.com/maya/tutorials/render...ders/175-2.html Quote Link to comment Share on other sites More sharing options...
kensonuken Posted January 6, 2009 Author Share Posted January 6, 2009 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? Quote Link to comment Share on other sites More sharing options...
kensonuken Posted January 6, 2009 Author Share Posted January 6, 2009 (edited) the one on highend3d.. http://highend3d.com/maya/tutorials/render...ders/175-2.html Im trying to get something like this... Edited January 6, 2009 by kensonuken Quote Link to comment Share on other sites More sharing options...
Jason Posted January 6, 2009 Share Posted January 6, 2009 the one on highend3d..http://highend3d.com/maya/tutorials/render...ders/175-2.html Im trying to get something like this... I cant look at this myself right now; but FYI I've just added up/download permissions to this forum (Shaders). Quote Link to comment Share on other sites More sharing options...
kensonuken Posted January 7, 2009 Author Share Posted January 7, 2009 thanks jason Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.