Planetside Software Forums

General => Terragen Discussion => Topic started by: Roberts on July 19, 2010, 07:22:19 AM

Title: Warp shader and Image map?
Post by: Roberts on July 19, 2010, 07:22:19 AM
Do they work together? Can I use the warp shader to warp an image map? I am able to set up a node network with a PF shader that is warped by a warp shader, but if I change the "shader" in the warp shader to use an image map shader instead, the warping effect is lost...
Is this a limitation to the program or is it- as usual - my own limitation... ;)

Regards

Robert
Title: Re: Warp shader and Image map?
Post by: dandelO on July 19, 2010, 05:51:57 PM
You need a 'get position in texture' function and 'plan Y' mapping in the image map shader, otherwise, the image map shader can't provide any tex coords to be warped. :)

LIES!

I had my brain on backwards before I typed that, of course an image map supplies tex coord's to the warp shader, it has its own position translate fields! :D

See below, sorry. :)
Title: Re: Warp shader and Image map?
Post by: Roberts on July 20, 2010, 04:20:43 AM
Thanks for your reply DandelO!

But where do I plug the "get position in texture" function? Into the image map shader or into the warp shader?  Plugging it into the "input" of the image map shader seems to do nothing (which makes sense to me). Plugging it between the image map shader and the warp shader just gives me funky colors and a noise pattern...I have tried both ways, so maybe it´s supposed to be some other way around?

Thanks

Robert
Title: Re: Warp shader and Image map?
Post by: dandelO on July 20, 2010, 04:46:27 PM
I'm sorry, Roberts. What I typed up there is completely wrong.

An image map shader is actually one of the shaders that doesn't require a 'get position in texture' node.
A power fractal, however, in my experience, does. I was back to front, sorry.

I don't understand how you're warping a power fractal without it, a single power fractal won't feed any texture coordinates to the warp shader. Could you post a screenshot or example file?

*** Ahhh, perhaps the power fractal that is being warped is linked to the main node chain before the planet, taking coordinates from the  compute terrain node? I like to warp the raw shader before adding it to the main network.

I'll post an example of how I'd do it for both methods in a wee while, unless anyone beats me to it, a bit busy right now, getting ready for a festival! 8)
Title: Re: Warp shader and Image map?
Post by: dandelO on July 20, 2010, 05:30:46 PM
So, here's how I'd warp an image map shader, which is your main question:
[attachimg=#]
You can either use only one of the X,Y or Z inputs of the redirect shader to specify the warp direction or, use them all to warp in all directions. Since there's no displacement here, I used only the X and Z.
A good thing to also note here, for anyone who doesn't know, is that, the amount of warping applied comes from the 'displacement amplitude' of the warping power fractal shader.

Warping a power fractal is a little bit different(the way I do it, at least), I'll post that later, on my next break... :D
Title: Re: Warp shader and Image map?
Post by: Roberts on July 20, 2010, 06:22:03 PM
Perfect!

Thank you so much, DandelO! It´s working! (which you already know, of course ;))

Now I can add some irregularities to my imagetextures.

Regards

Robert
Title: Re: Warp shader and Image map?
Post by: dandelO on July 20, 2010, 06:31:40 PM
Here's the way I'd warp a power fractal shader:

[attachimg=#]

A power fractal shader supplies no tex coord's to the warp shader when used on it's own so, the warp shader doesn't know what to apply warping to. Just plug a 'get position in texture' node into its input to supply them.

Title: Re: Warp shader and Image map?
Post by: dandelO on July 20, 2010, 08:49:00 PM
Quote from: Roberts on July 20, 2010, 06:22:03 PM
Perfect!

Thank you so much, DandelO! It´s working! (which you already know, of course ;))

Now I can add some irregularities to my imagetextures.

Regards

Robert

:) Glad you got it going!
There's very little documentation for things like the warp shader or, rather, how to use it on different kinds of shaders, and such. Other than to say it 'warps a shader by another shader', there's no instruction about its implementation for the different types of shaders that could be used with it.

For example: I've never seen written that;

- The warp shader's amount of warp is controlled by the 'displacement' value of the 'warper'...
- That, warp direction needs to be specified independently, via yet another shader(redirect)...
- Or, even, that tex coord's are required at all, for the most common TG2 shader, that would most likely be used here(the power fractal).

The above may, or may not, be completely true, like I say, I've never seen any actual instructions on the correct operation of the warp shader.

I'd like a warp shader node, that includes a built-in 'Get position from input-A/B', with 'Warp direction X/Y/Z' check-boxes and, its own 'warp amount' parameter. That would keep things all in the one, convenient node. And, it would work just like the node reference (http://www.planetside.co.uk/docs/tg2/noderef/window_7_5_7.html?MenuState=HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABEAAABAEAAAAcAAAEAAAEAAEwVVB) says it should! ;) :D
Title: Re: Warp shader and Image map?
Post by: dandelO on July 20, 2010, 10:12:42 PM
* Sorry, best to also mention that;

If you're warping a power fractal in the above way, make sure that both its 'high' and 'low' colours are checked(even if one of them is black).
If you don't, you'll just get the 'funky colours and a noise pattern', that Roberts found above. ;)
Title: Re: Warp shader and Image map?
Post by: Henry Blewer on July 21, 2010, 08:08:43 AM
I had to bookmark the site. The critics are raving!
Title: Re: Warp shader and Image map?
Post by: airflamesred on July 21, 2010, 04:42:55 PM
Great site DandelO - Terragen with a VIZ topping!
Title: Re: Warp shader and Image map?
Post by: Dune on July 22, 2010, 02:38:08 AM
I had a great time checking out your site, Dandel0. Your creativity is virtually endless. Thanks.

---Dune
Title: Re: Warp shader and Image map?
Post by: dandelO on July 22, 2010, 05:15:04 AM
:D

Cheers, folks!

Come again!
Title: Re: Warp shader and Image map?
Post by: Hannes on July 22, 2010, 11:23:59 AM
This is fantastic. A few days ago I wondered how an image map shader could be warped and right now I just read your solution. Thank you!!!!!!!!!!!!!!
Title: Re: Warp shader and Image map?
Post by: Hetzen on July 22, 2010, 04:33:19 PM
Good investigations here DandelO. The Warp shader and Redirect have always seemed a liitle aloof in what they do. It's good to see you put in some leg work on these, because the documentation is, I'm afraid, pants, on two important shaders. Saying that, I've never needed to use a 'Get Position in Texture' to drive a PF before, I think you maybe mistaken on that front, but I'll hold my hands aloft if you proove me wrong (or a DJ kicks off on a belting tune).
Title: Re: Warp shader and Image map?
Post by: Roberts on July 24, 2010, 07:30:46 AM
Hi all!

Now I´ve bumped into another problem with the warp shader and the image map. I now have set up a scene where I want an image map that is projected through a camera to be warped. The fact that the image is projected through a camera seems to totally take away the warping effect I want. If I use another projection, plan Y for example, the warping takes place as it should. Do I need some function node to maybe get the "image coordinates" from the camera projection or something?

Robert
Title: Re: Warp shader and Image map?
Post by: dandelO on July 26, 2010, 05:48:46 PM
Quote from: Hetzen on July 22, 2010, 04:33:19 PM
...Saying that, I've never needed to use a 'Get Position in Texture' to drive a PF before, I think you maybe mistaken on that front....

Yes, Hetzen. You are correct.
The last project I was working on that involved the warp shader was my voronoi caustics thing.
In that case, of course, a Get Position in Texture node is required to warp the base voronoi 3d diff scalar 'function' by a fractal shader.

[attachimg=#]

I think I'd just drummed it into my head that it was required when dealing with other shaders, too.
A power fractal will provide tex coords to the warp shader, as you say. :)
My mistake.

EDIT: Added small image.
Title: Re: Warp shader and Image map?
Post by: dandelO on July 26, 2010, 05:53:23 PM
Roberts: See this post by Matt on your exact problem: http://forums.planetside.co.uk/index.php?topic=7213.msg76923#msg76923

I think you might need to use the plan Y option and relocate your image map shader coord's to the desired location.
Title: Re: Warp shader and Image map?
Post by: Roberts on July 27, 2010, 05:22:54 PM
Thanks for the tip!

I am now using the "side Z" projection, which works as well for the effect I´m after this time. It´s a pity though that we cannot warp an image that is projected through a camera. Or is there perhaps a way?

Roberts