View Full Version : shaderFX: lit sphere shader?
07-06-2011, 05:36 AM
Hi, I'm wondering if anyone could give me some pointers creating a sphere map shader in shaderfx. There's one in the examples but I can't seem to get it to display correctly (it says set the vector space to world, but it appears that's the default anyway. it just looks like a smudge of colour)
07-06-2011, 05:50 AM
Convert surface normal to screen-space (you always want the sphere map to be mapped in screen-space).
Use this normal as UV coordinate to sample from texture. The ss. normal will probably be in -1 to 1 range, while UV's are in 0-1 range. Plus, the normals need to start sampling from the center of the texture.
So, divide surface normals by 2 to scale them into a range of 1, then add 0.5 to them to translate them to the center.
Then just use only the X and Y components as UV's coordinates to sample.
Should be all there is to it save for some details.
07-06-2011, 03:13 PM
did a spheremap node once
should do the job
shaderfx cant convert from tangent to view space
first you have to convert to modelspace then to viewspace
then add 1 and divide by 2
07-07-2011, 11:36 AM
thanks arrangemonk, however when I try load the file I get the message 'file did not load correctly due to missing node(s): SphereMapping
do I need another file to go with it?
07-07-2011, 11:42 AM
I think they changed the node:
07-07-2011, 11:46 AM
I dunno ace I had a look on their forums and posts from 2006 suggest they've never had sphere mapping apart from the example file (which uses custom code rather than a node I think?). btw, does that example file work? am I just using it wrong somehow?
07-07-2011, 11:58 AM
I checked it, and no dice. So I suppose you used a custom code ArrangeMonk? When I delete the last 3 lines of SphereMapping code, it loads, but I only get a Standard with a Texture.
07-08-2011, 09:11 AM
sorry, i fogot to give you the actual node
copy both files to
3ds Max root\Scripts\ShaderFX\Nodes
and it should work
07-08-2011, 11:24 AM
Awesome sauce man!
07-08-2011, 03:57 PM
spot on arrangemonk, nice one cheers :)
07-09-2011, 12:09 PM
Thanks for sharing this, arrangemonk. With your permission I'd like to alter it so that it supports an incoming normal socket (instead of using the normal from the surface vector node) so that it can be used with normal maps. I'd like to include the altered version in our next update of ShaderFX. Is that OK with you?
07-09-2011, 01:55 PM
do as you wish,
nothing to object to XD
07-09-2011, 02:09 PM
I'm using a custom code node currently. A build in node is nice!
07-27-2012, 02:56 PM
sorry for necroposting but when are you planning to release the verson including the spheremap node?
07-27-2012, 11:14 PM
I think they already included it in the latest version? Although it kinda buggy, so your mileage may vary.
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.