Planetside Software Forums

General => Terragen Discussion => Topic started by: cyphyr on October 28, 2010, 07:50:55 PM

Title: Simple shape shader woes!
Post by: cyphyr on October 28, 2010, 07:50:55 PM
I can use a re-direct shader to distort a simple shape shaders displacement but how can I get the colour to distort as well?
As you can see from the VERY simple example below the simple shape shader maintains its colour in a streight line even though the displacement is distorted.
Both colour and displacement have the same settings.
I have a feeling that there may be a blue function solution but I cant see where I'd add the "get" function.
I've tried adding "compute terrain's" and re-creating the "Re-direct" shader group below the last Compute terrain all to no avail.
Is this doable or am I once again yapping up the wrong tree?!
:)
cheers
Richard
Title: Re: Simple shape shader woes!
Post by: cyphyr on October 29, 2010, 07:53:54 PM
24 hours and no interest or answer :(
Is this just a dumb question and I've missed some point that's been covered many times. If so I cant find it.
Sorry, feeling sorry for myself stuck in London looking after ailing parents
Richard
Title: Re: Simple shape shader woes!
Post by: dandelO on October 29, 2010, 08:28:08 PM
Sorry, Richard. I downloaded this first and played with it for about an hour looking for a workaround, I should've came back.

No luck yet, the redirect shader seems to only accept/output displacement data. I think that you'd need to separate the colour and displacement functions, I tried using simple shapes after compute terrain, scalar to colour, other things too, to no avail.

It's curious that you can redirect X/Z colour from other colour shaders and image maps etc. but not from a redirected simple shape. I think maybe if the simple shape shader had a coordinate system(like a painted shader does, you can't redirect a 'final position' paint shader but, you can redirect a 'position in terrain/texture' one) then, maybe it'd be possible without a separate colour/displacement workaround.

Sorry for not getting back to this thread afterwards, if I come up with anything I'll be sure to let you know my findings, such as they may be...
Title: Re: Simple shape shader woes!
Post by: dandelO on October 29, 2010, 08:33:31 PM
I think I might have answered the question in my reply, when I think about it from a distance, and I think you're probably right, that you'll need a blue solution(scalar to colour, position in texture) for this. I'll try again tomorrow...
Title: Re: Simple shape shader woes!
Post by: cyphyr on October 29, 2010, 08:40:08 PM
Thanks :)
Probably time I got over myself lol
and went to bed!
Richard
Title: Re: Simple shape shader woes!
Post by: Oshyan on October 29, 2010, 08:46:50 PM
Sorry for not responding. Truth is I don't really know the answer. But I think you and dandelO might be on the right track, if it's possible, with a "get position" and maybe some type conversion...

- Oshyan
Title: Re: Simple shape shader woes!
Post by: dandelO on October 29, 2010, 09:03:46 PM
Quote from: cyphyr on October 29, 2010, 08:40:08 PM
Thanks :)
Probably time I got over myself lol
and went to bed!
Richard

Not at all! The night is young! ;)
Title: Re: Simple shape shader woes!
Post by: Dune on October 30, 2010, 02:14:39 AM
What if you feed the information into the blend input of a surface shader and use that as a mask...
Title: Re: Simple shape shader woes!
Post by: Goms on October 30, 2010, 03:18:52 AM
I think the solution is not to use the simple shape shader, as it uses a final position (which is the explanation for the problem imho).
Instead i would use something like this (important: get position in texture):

(http://img215.imageshack.us/img215/8152/clipboard01wa.jpg)

Title: Re: Simple shape shader woes!
Post by: cyphyr on October 30, 2010, 04:19:26 AM
Thankyou everyone and especialy Goms  ;D
I think this will be the final piece for my the world project. I really wanted a river running through it but not a streight ditch, a propper bendy river.
Apologies for my peve earlier  :-[
better now
Richard
Title: Re: Simple shape shader woes!
Post by: Goms on October 30, 2010, 05:22:17 AM
welcome ,)

in this case add a square scalar behind the clamp 0 scalar. this will give you a smoother "beach".
Title: Re: Simple shape shader woes!
Post by: Henry Blewer on October 30, 2010, 08:20:26 AM
I did not have a clue where to even start with this one.
Title: Re: Simple shape shader woes!
Post by: Goms on October 30, 2010, 08:26:12 AM
hm. shall i write some basic "how to use functions"-tutorial? would need some time as i suffer from a small work-overflow atm, but may be useful...
i did a lot with functions the lasts months. and even if there was no usable finished render as output, i think i got a pretty good idea about how to use them.
Title: Re: Simple shape shader woes!
Post by: Henry Blewer on October 30, 2010, 08:31:21 AM
I struggle with them. I do not know the formulas they are based on. I can write functions, then call them...

I think a tutorial would be HUGE. 8) A great help for many.
Title: Re: Simple shape shader woes!
Post by: dandelO on October 30, 2010, 11:00:57 AM
Quote from: Goms on October 30, 2010, 03:18:52 AM
I think the solution is not to use the simple shape shader, as it uses a final position (which is the explanation for the problem imho).
Instead i would use something like this (important: get position in texture):

I knew it would be something like this. As soon as I read back what I wrote about some things that didn't work, it struck me. :D
Cheers, Goms!
Title: Re: Simple shape shader woes!
Post by: cyphyr on October 30, 2010, 01:22:06 PM
I have just returned from London and a quick look say this works perfectly :)
Thankyou so much to all who have helped and a big extra thanks to Goms, you are the function king !!
A tutorial on functions would be great. Its been asked for so many times before and the response has always been to say that a good grounding in math was necessary. I get some higher math but to be honest when I left school most of it left me. If you could write a function tutorial that was aimed at artists then you would have a very useful product, one that would be aprieciated throught the community.
Thanks again
Richard
Title: Re: Simple shape shader woes!
Post by: Goms on October 30, 2010, 03:28:05 PM
welcome.
first 6 pages done. i think i will need someone of english tongue and some knowledge about functions later to correct it....
anyone? :D
Title: Re: Simple shape shader woes!
Post by: Goms on October 30, 2010, 04:45:11 PM
Ok, first part done. 10 pages written so far.
Some things are still missing, as other ways to archive what i did here, but i would like to hear some opinions about how i wrote this before i continue.
Richard, could you look over it and tell me what you think? Would be great; i know from the past that what i write is not always easy to understand. :D
Everyone else: please give me feedback too!

note: my native tongue is not English. ;)


http://www.file-upload.net/download-2931640/functions-alapha.rar.html
Title: Re: Simple shape shader woes!
Post by: Oshyan on October 30, 2010, 04:49:50 PM
If you add this to the wiki, everyone could work on improving it. Just a thought. :) http://www.planetside.co.uk/wiki/

- Oshyan
Title: Re: Simple shape shader woes!
Post by: Goms on October 30, 2010, 05:11:01 PM
I will, when its done ;)
i just don't have the time atm to add all the images etc.
if i find the time to work on this every week one evening, it may be done until xmas, where i have enough time again to make it a good wiki entry.
For now i first want to know if its usable at all.
Title: Re: Simple shape shader woes!
Post by: Oshyan on October 30, 2010, 06:06:50 PM
Sounds good. Thanks for putting in the time. :)

- Oshyan
Title: Re: Simple shape shader woes!
Post by: Henry Blewer on October 30, 2010, 06:31:46 PM
I just downloaded the alpha version. I'll take a look and check your English. Just remember, I'm American and don't speak proper English either. I speak some strange local dialect of American English we use locally. Darn gnarly. ::)
Title: Re: Simple shape shader woes!
Post by: Goms on October 31, 2010, 05:17:32 AM
looks like I'll have to change it anyway; just checked the file again, and there are some nasty render-glitches again. :(
They seem to come always when using an X or Z only noise...

(http://img502.imageshack.us/img502/2028/67520932.jpg)
Title: Re: Simple shape shader woes!
Post by: mhaze on October 31, 2010, 09:06:34 AM
I've had the same problem :-\
Title: Re: Simple shape shader woes!
Post by: Goms on October 31, 2010, 09:21:56 AM
Using the setup I've mentioned (a power fractal with great scaling in one direction) solves this problem. I'll change this asap.
Title: Re: Simple shape shader woes!
Post by: Henry Blewer on October 31, 2010, 12:06:23 PM
I always use a power fractal as the last node on top of the surface layer. The noise functions/node network get plugged into the input of the power fractal. It seems to make the output of the network scale correctly.
Title: Re: Simple shape shader woes!
Post by: jo on October 31, 2010, 08:14:30 PM
Hi,

Sorry I didn't answer sooner. I wrote the Simple shape shader and to be honest I didn't understand exactly what was going on here until I had a chance to look into it more closely. The reason the colour isn't being redirected by the Redirect shader is that the Redirect shader only works with displacements. That's probably why it's in the Displacement shaders menu but not the Colour shaders one. To use the redirected displacement of the Simple shape shader as a colour mask as you are I think you will probably need to find a way of extracting the displacement with functions and converting it to a colour, however I'm struggling to see a way to do that which would work generally.

Looking at the image map shader I don't see how the colour of that could be redirected either. However someone mentioned it can be? If someone could post a clip with the colour of an image map shader being redirected by the Redirect shader I'd be interested to see it.

Regards,

Jo
Title: Re: Simple shape shader woes!
Post by: dandelO on October 31, 2010, 09:27:03 PM
That would be me.

An image map can be redirected because it has the option 'plan Y'.
If an example is needed. I'll upload one.

* Actually, I'll upload one anyway, I might not be here for long tonight, 2 secs...
Title: Re: Simple shape shader woes!
Post by: dandelO on October 31, 2010, 09:48:23 PM
There you go. I set it as a child of a surface layer.

Default image map - in network:
[attachimg=#]

Redirected image map - independent child layer:
[attachimg=#]

Layout:
[attachimg=#]

The image map shader has 'plan' properties, making it redirect/warpable on any axis.

Title: Re: Simple shape shader woes!
Post by: dandelO on October 31, 2010, 09:55:34 PM
I gather, if the simple shape shader had a coordinate system(like the similar image map shader and painted shaders do) then, it would be able to be redirected, too... ???

*** I should say also that it doesn't need to be connected to the main network either, you can use a redirected image as a cloud layer deformer as well. It isn't limited to the planet/terrain nodes. ***
Title: Re: Simple shape shader woes!
Post by: jo on November 01, 2010, 04:23:31 AM
Hi dandelO,

Thanks for that. It's led me to some interesting conclusions such as:

- Even the image map shader won't be redirected if you hook it up to the Blending shader input of a surface layer, as Richard had it originally. It's the same with the Colour function input and I'm guessing the other "property" inputs such as Luminosity etc. However if you hook it up to the Child layers as you did in your example input it will redirect.

- Even if you hook it up to the Child Layers input the Image map shader still won't redirect unless you turn on the displacement settings in the Power fractal feeding the redirect shader. I had a frustrating time with this not working with the image map shader until I clicked that I needed to change the displacement settings.

This suggests to me that as I said this only works with the displacement side of shaders, which is what the Redirect shader is dealing with. When I was looking at this in the debugger I noticed that there was some sort of conversion going on. I forget what it was right now!

I've attached an image and screenshot showing what Richard was attempting "working". Whether it's quite what he was aiming for is something else :-). However I did have to change the Simple shape shader to use the position in texture for the warping/redirection to work, so you won't actually be able to replicate the results in the current version of TG2. I'd overlooked where this was being done in the image map shader. I will add a param to select between final position and the position in texture.

Regards,

Jo
Title: Re: Simple shape shader woes!
Post by: dandelO on November 01, 2010, 06:29:16 AM
QuoteI will add a param to select between final position and the position in texture.

Excellent! 8)

Actually, to redirect or warp any shader, you must use the displacement controls of the redirecting/warping function. This isn't really documented anywhere and is probably the reason that many people have trouble, more so with the warp shader in particular. A redirection kind of suggests that you'll need to add some displacement, warping is more cryptic in this regard, I think.

As for the redirected image map shader, I only set it as the child of a surface layer to show how it didn't need connected to the actual main network to take its coordinates from, it supplies them itself, according to its plan setting. You can obviously omit the surface layer and hook it up to the network in series and it will redirect in the very same way, except it will also redirect any previous shaders in the network, too.

So, with a new simple shape shader in the works, any chance of a wee rotation control in the transform shader, again... :P ;)
Title: Re: Simple shape shader woes!
Post by: cyphyr on November 01, 2010, 11:24:15 AM
Thankyou Jo :)
Yes that was exactly what I was trying to replicate. Goms did come up with an alternative that will work for my needs for the moment. Your improved s³ will I think be a great improvement when released for the next update (?)
:)
Richard
Title: Re: Simple shape shader woes!
Post by: Matt on November 04, 2010, 12:04:29 AM
I hope this doesn't confuse things even further, but I see a lot of confusion over the purpose of the Redirect and Warp Shaders.

The 'redirect' in the name Redirect Shader means "redirect a displacement shader to displace along the X/Y/Z axis instead of the surface normal". Its only purpose is to change what direction a displacement shader works in, because most displacement shaders only displace along the surface normal. The Redirect Shader allows you to make sideways displacement, for example. Now, if you apply this to a surface (e.g. your terrain) and you have some other shaders, whether they are displacements or colour shaders, they will be affected by the displacement as long as those shaders work with texture coordinates, not final position. (If the shaders work with final position, they will just appear to be 'pasted' over the top of the displaced surface without bending sideways with it.)

'Redirect' is completely different from the Warp Shader. The Warp Shader allows you to use a displacement shader to distort the texture space used by another shader, which means you can warp, distort or move a particular shader without actually affecting anything else about the surface.

Redirect Shader is easily confused with the Warp Shader because, quite often, both shaders are used together to achieve a particular effect. For example, if I want to warp a texture space in 3D, the displacement that describes the warp might need to be in X, Y and Z directions. To do that I use a Redirect Shader with 3 displacement shaders attached to the X, Y and Z inputs. That Redirect Shader then becomes a 3D displacement which I plug into the warp shader to tell it how to warp the texture space of another shader. Only shaders that work with texture coordinates, not final position, will be affected by the Warp Shader.
Title: Re: Simple shape shader woes!
Post by: mhaze on November 06, 2010, 10:09:08 AM
Hi

I've been developing a picture around this and have learn't a lot from this -thanks Goms, but I still can't get rid of the noisy spikes. Any help gratefully received. Mick