Reply
Reply
 
Thread Tools Display Modes
rooster's Avatar
Old (#1)
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)

any tips?
cheers!
-rich
www.redprodukt.com
Rich Make Game! twitter: @RichMakeGame
"You can't edit nothing"
Offline , Counter of Polys™, 6,426 Posts, Join Date Dec 2004, Location Newcastle, uk  
   Reply With Quote

Xoliul's Avatar
Old (#2)
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.
Offline , card carrying polycounter, 2,429 Posts, Join Date Oct 2008, Location London, UK Send a message via MSN to Xoliul  
   Reply With Quote

arrangemonk's Avatar
Old (#3)
http://dl.dropbox.com/u/1484680/spheremap.SFX

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

Last edited by arrangemonk; 07-06-2011 at 04:12 PM..
DARN it hurts my eyes
Offline , dedicated polycounter, 1,347 Posts, Join Date Jun 2007, Location Germany Send a message via ICQ to arrangemonk Send a message via MSN to arrangemonk Send a message via Skype™ to arrangemonk  
   Reply With Quote

rooster's Avatar
Old (#4)
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?
cheers!
www.redprodukt.com
Rich Make Game! twitter: @RichMakeGame
"You can't edit nothing"
Offline , Counter of Polys™, 6,426 Posts, Join Date Dec 2004, Location Newcastle, uk  
   Reply With Quote

Ace-Angel's Avatar
Old (#5)
I think they changed the node:

http://knol.google.com/k/shader-fx-environment-mapping#
There's a very good chance that I experienced MORE problems, then all the internet put together in the area of 3D. Talk about being original for once...
Offline , veteran polycounter, 4,501 Posts, Join Date Apr 2011, Location Canada  
   Reply With Quote

rooster's Avatar
Old (#6)
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?
www.redprodukt.com
Rich Make Game! twitter: @RichMakeGame
"You can't edit nothing"
Offline , Counter of Polys™, 6,426 Posts, Join Date Dec 2004, Location Newcastle, uk  
   Reply With Quote

Ace-Angel's Avatar
Old (#7)
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.
There's a very good chance that I experienced MORE problems, then all the internet put together in the area of 3D. Talk about being original for once...
Offline , veteran polycounter, 4,501 Posts, Join Date Apr 2011, Location Canada  
   Reply With Quote

arrangemonk's Avatar
Old (#8)
sorry, i fogot to give you the actual node
http://dl.dropbox.com/u/1484680/GRP_SphereMapping.ms
http://dl.dropbox.com/u/1484680/GRP_SphereMapping.sfx

copy both files to
3ds Max root\Scripts\ShaderFX\Nodes
and it should work

Last edited by arrangemonk; 07-08-2011 at 09:17 AM..
DARN it hurts my eyes
Offline , dedicated polycounter, 1,347 Posts, Join Date Jun 2007, Location Germany Send a message via ICQ to arrangemonk Send a message via MSN to arrangemonk Send a message via Skype™ to arrangemonk  
   Reply With Quote

Ace-Angel's Avatar
Old (#9)
Awesome sauce man!
There's a very good chance that I experienced MORE problems, then all the internet put together in the area of 3D. Talk about being original for once...
Offline , veteran polycounter, 4,501 Posts, Join Date Apr 2011, Location Canada  
   Reply With Quote

rooster's Avatar
Old (#10)
spot on arrangemonk, nice one cheers
www.redprodukt.com
Rich Make Game! twitter: @RichMakeGame
"You can't edit nothing"
Offline , Counter of Polys™, 6,426 Posts, Join Date Dec 2004, Location Newcastle, uk  
   Reply With Quote

Ben Cloward's Avatar
Old (#11)
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?
Offline , spline, 118 Posts, Join Date Jul 2005, Location Austin, Texas, USA Send a message via MSN to Ben Cloward  
   Reply With Quote

arrangemonk's Avatar
Old (#12)
do as you wish,

nothing to object to XD

Last edited by arrangemonk; 07-09-2011 at 01:59 PM..
DARN it hurts my eyes
Offline , dedicated polycounter, 1,347 Posts, Join Date Jun 2007, Location Germany Send a message via ICQ to arrangemonk Send a message via MSN to arrangemonk Send a message via Skype™ to arrangemonk  
   Reply With Quote

rollin's Avatar
Old (#13)
I'm using a custom code node currently. A build in node is nice!
Offline , card carrying polycounter, 2,123 Posts, Join Date Oct 2004, Location munich, germany  
   Reply With Quote

arrangemonk's Avatar
Old (#14)
sorry for necroposting but when are you planning to release the verson including the spheremap node?
DARN it hurts my eyes
Offline , dedicated polycounter, 1,347 Posts, Join Date Jun 2007, Location Germany Send a message via ICQ to arrangemonk Send a message via MSN to arrangemonk Send a message via Skype™ to arrangemonk  
   Reply With Quote

Ace-Angel's Avatar
Old (#15)
I think they already included it in the latest version? Although it kinda buggy, so your mileage may vary.
There's a very good chance that I experienced MORE problems, then all the internet put together in the area of 3D. Talk about being original for once...
Offline , veteran polycounter, 4,501 Posts, Join Date Apr 2011, Location Canada  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch