hoknamahn Posted May 10, 2008 Share Posted May 10, 2008 Hey shader monsters, This could be really stupid question but I'm not sure... How to shade an object made from a sand? From one side we wish to show the shapes of that object so N has to be interpolated across the surface as usual using Phong's ideas. In this case we will see a proper diffuse component of lighting. But specular will be wrong. If we think about sand object as a set of micro spheres we can handle "correct" specular. But diffuse in this case won't represent a shape of object but rather shapes of those sand particles. Is it good idea to use normals of our object to catch diffuse and normals on "sand particles" which are spheres for calculation of specular? Could it give us a look close enough to real life? But even if my idea is not bad for "rock solid" object what if that object desintegrates over time? Specular component still could be okay but what about diffuse? Any ideas about "physically correct" and just "good" representation of such effects? And do not concentrate on details such as implementation, representation of those sand particles and so on. The only one interesting thing is how to calculate normals ie mathematics. Thanks a lot. Quote Link to comment Share on other sites More sharing options...
MIguel P Posted May 10, 2008 Share Posted May 10, 2008 Hey shader monsters,This could be really stupid question but I'm not sure... How to shade an object made from a sand? From one side we wish to show the shapes of that object so N has to be interpolated across the surface as usual using Phong's ideas. In this case we will see a proper diffuse component of lighting. But specular will be wrong. If we think about sand object as a set of micro spheres we can handle "correct" specular. But diffuse in this case won't represent a shape of object but rather shapes of those sand particles. Is it good idea to use normals of our object to catch diffuse and normals on "sand particles" which are spheres for calculation of specular? Could it give us a look close enough to real life? But even if my idea is not bad for "rock solid" object what if that object desintegrates over time? Specular component still could be okay but what about diffuse? Any ideas about "physically correct" and just "good" representation of such effects? And do not concentrate on details such as implementation, representation of those sand particles and so on. The only one interesting thing is how to calculate normals ie mathematics. Thanks a lot. Hm, I suppose using shadows would be the correct way to do it, but of course more time consuming when rendering. Try with deep shadows, I did some falling sand and worked for me. Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted May 10, 2008 Author Share Posted May 10, 2008 [quote name='MIguel P Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 12, 2008 Share Posted May 12, 2008 And do not concentrate on details such as implementation, representation of those sand particles and so on. Actually, I think "representation" will dictate the approach in this case: If it desintegrates, then you'll presumably be shading particles, and so the lighting model can be evaulated normally (regardless of whether the shape of each grain is implicit or explicit). If, on the other hand, we only ever see the entire collection of grains from a mid-to-far distance, then you can resort to a statistically-based method (the assumption being that many thousands of these grains fit in a single bucket). Lastly, if the representation needs to withstand scrutiny from both extreme close-up to far field, then you need to combine both approaches somehow. I'd probably start by looking at all the "far fur" solutions floating out there (all of which derive some sort of statistical method), and modify those ideas to fit the kind of particle distributions (and shading approach) you might take with your near-field model (the particle shading approach) -- i.e: the chosen particle shading model drives the choices when deriving the statistical method. Just thinking out loud here... Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted May 12, 2008 Author Share Posted May 12, 2008 Actually, I think "representation" will dictate the approach in this case: If it desintegrates, then you'll presumably be shading particles, and so the lighting model can be evaulated normally (regardless of whether the shape of each grain is implicit or explicit). If, on the other hand, we only ever see the entire collection of grains from a mid-to-far distance, then you can resort to a statistically-based method (the assumption being that many thousands of these grains fit in a single bucket). Lastly, if the representation needs to withstand scrutiny from both extreme close-up to far field, then you need to combine both approaches somehow.I'd probably start by looking at all the "far fur" solutions floating out there (all of which derive some sort of statistical method), and modify those ideas to fit the kind of particle distributions (and shading approach) you might take with your near-field model (the particle shading approach) -- i.e: the chosen particle shading model drives the choices when deriving the statistical method. Just thinking out loud here... Hi Mario, I got your idea concerning to statistical methods. But I think about particles only. No "hard" surfaces like polygons or NURBS. So the question is: "Should we take into account the shape of object or the shape of sand particle or we have to use shapes of object for diffuse only and particle for specular only. Or some kind of blend". It's much easier to illustrate. This is a table with very rough setup of my idea. First picture is just straight Phong - i.e. use the normal of particle (in this case just a sphere) for calculation of diffuse and specular components. The second one at the bottom - using of normals from polygonal object for calculation of diffuse and normals on sand particles for specular. Specular is the same on both pictures but deffuse is completely different: on the first picture diffuse represents the shape of particle but on the second - the shape of dragon. Which one is "closer" (I understand how far it is from real sand ) to real look? Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted May 12, 2008 Author Share Posted May 12, 2008 (edited) Yeah finally I found some pictures like this one and we really can't notice specular as separate component because of very small size of particles. So probably as you said Mario I need some mix of statistical methods and normal ones. I'll dig it. Thanks! http://upload.wikimedia.org/wikipedia/comm...tle_in_sand.JPG Edited May 12, 2008 by hoknamahn Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 12, 2008 Share Posted May 12, 2008 So the question is: "Should we take into account the shape of object or the shape of sand particle or we have to use shapes of object for diffuse only and particle for specular only. Or some kind of blend". The "diffuse-from-geo + spec-from-sphere" goes a bit in the direction of the kind of statistical approach I was talking about. In the context of your "diffuse-from-geo + spec-from-sphere" test, it can be interpreted as basically saying that once these particles get small enough (or we're standing enough away from them), we decide that their diffuse reflectance approaches Lambert (in reality, I'm guessing they would approach something a little more directional than pure Lambert, but that's just a guess). So yeah, given your test picture, what I was suggesting reduces to the following: Use the standard sphere-normal based approach (with whatever reflectance model you choose as your desired look). This becomes your near-field "this is what they really look like" model. Then grab a chunk of what you consider to be a "typical" distribution of those spheres and integrate the lighting models over the whole chunk at various known incidence/exitance combinations. Next, try to come up with some analytical approximation to model what you're seeing. This becomes your far-field statistical model. Finally, choose some method to smoothly blend between the two approaches based on how many particles project to a single pixel or some similar metric. Easier said than done, of course, but that's basically what I was suggesting. It has been done successfully for fur, that's why I mentioned it. Unfortunately I can't remember the titles of the papers I'm thinking about, but they should pop up with a quick google search. Let us know how it goes! Cheers. Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted May 12, 2008 Author Share Posted May 12, 2008 Thanks for ideas Mario! Quote Link to comment Share on other sites More sharing options...
edward Posted May 26, 2008 Share Posted May 26, 2008 I recall from the Sandman sketch last year, SPI used tetrahedron approximations for rendering sand grains at certain LODs. 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.