|
created shaderFX: lit sphere shader?
on 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)
any tips?
cheers!
-rich
|
, Counter of Polys™,
6,426 Posts,
Join Date Dec 2004,
Location Newcastle, uk
|
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.
|
, card carrying polycounter,
2,429 Posts,
Join Date Oct 2008,
Location London, UK
|
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
|
|
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!
|
, Counter of Polys™,
6,426 Posts,
Join Date Dec 2004,
Location Newcastle, uk
|
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...
|
, veteran polycounter,
4,501 Posts,
Join Date Apr 2011,
Location Canada
|
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?
|
, Counter of Polys™,
6,426 Posts,
Join Date Dec 2004,
Location Newcastle, uk
|
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...
|
, veteran polycounter,
4,501 Posts,
Join Date Apr 2011,
Location Canada
|
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
|
|
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...
|
, veteran polycounter,
4,501 Posts,
Join Date Apr 2011,
Location Canada
|
spot on arrangemonk, nice one cheers 
|
, Counter of Polys™,
6,426 Posts,
Join Date Dec 2004,
Location Newcastle, uk
|
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?
|
, spline,
118 Posts,
Join Date Jul 2005,
Location Austin, Texas, USA
|
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
|
|
I'm using a custom code node currently. A build in node is nice!
|
, card carrying polycounter,
2,123 Posts,
Join Date Oct 2004,
Location munich, germany
|
sorry for necroposting but when are you planning to release the verson including the spheremap node?
DARN it hurts my eyes
|
|
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...
|
, veteran polycounter,
4,501 Posts,
Join Date Apr 2011,
Location Canada
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Copyright 1998-2012 A. Risch
|