Planetside Software Forums

General => Terragen Discussion => Topic started by: RichTwo on January 15, 2011, 10:00:57 AM

Title: Using Distribution Shader On Displacements?
Post by: RichTwo on January 15, 2011, 10:00:57 AM
I am attempting to control the altitude of a particular displacement so that I will have relatively smooth lower areas.  I have attached a Distribution shader to the node set-up and have set the minimum altitude to where I estimated the displacement should end.  It didn't work.  I even entered an extreme setting, and I still couldn't get any kind of result.  It's as if the Distribution shader is disabled.  Or I'm using the wrong shader - I don't know.

I'm probably missing something crucial and obvious and will once again bash my head on the keyboard when it's pointed out to me.  But if any TG2 genius out there wants to have a stab at it, I've attached the clip.  Sorry, you'll have to hook it up yourself.

Thanks for any help!

   
Title: Re: Using Distribution Shader On Displacements?
Post by: inkydigit on January 15, 2011, 10:51:16 AM
Hi Rich, I changed your clip a bit, used a surface layer to restrict height/slope etc, set displacements as a child layer....see attached, I hope this helps
cheers
Jason
:)
Title: Re: Using Distribution Shader On Displacements?
Post by: RichTwo on January 15, 2011, 12:46:53 PM
 Thanks, Jason - I tried it out but I'm afraid that it works about the same as the Distribution shader.  If I check any constraint setting, it completely cancels the displacement.  I've adjusted slope and altitude, and the fuzzy zones on both to all extremes and it's no use.  It shouldn't be so difficult to get this to work.   I'm wondering now if two shaders aren't meant to handle displacements. 
Title: Re: Using Distribution Shader On Displacements?
Post by: inkydigit on January 15, 2011, 04:07:15 PM
oh ok, it kind of worked, I am stumped also, it seems if it is either on or off??
anyone else got any ideas??
Title: Re: Using Distribution Shader On Displacements?
Post by: Henry Blewer on January 15, 2011, 08:07:13 PM
I use a redirect shader with power fractals. You can control the distribution of the power fractal/s by putting the distribution shader in the Blend by shader input. You have to check the Fit Blendshader to this.
Title: Re: Using Distribution Shader On Displacements?
Post by: Dune on January 16, 2011, 03:42:07 AM
It'll work if you add the line into the child input of the distribution shader, I figure, but you can also use a surface shader (uncheck color), blend it by your distribution shader, and add the line into the surface shaders child input.
Title: Re: Using Distribution Shader On Displacements?
Post by: RichTwo on January 16, 2011, 07:26:39 AM
I guess I don't fully understand or I'm doing something wrong again.  Still getting zero results, even with the doubled-up distribution / surface layer combo as Dune suggested.  Could I impose upon someone, anyone to donate a clip so I can try it out?  Thanks!
Title: Re: Using Distribution Shader On Displacements?
Post by: Tangled-Universe on January 16, 2011, 07:35:34 AM
Hi Rich,
Here you go, this file works.

I think there's often a general misunderstanding on how to approach/using constraints and the conditions which should be met in order to use those.

What I did in this file is first create an inverted crater to test your displacement function on. I computed this crater terrain first with a compute terrain node.
The compute terrain calculates the normals, which allow me to restrict for slope. It also calculates texture coordinates which allow me to restrict for altitude.
A compute normal node doesn't compute texture coordinates and a Tex coords from XYZ node doesn't calculate normals.
So in a nutshell, these are the most important things to consider before applying restriction for slope and/or altitude: you first need to calculate normals and/or texture coordinates.

After computing the crater shader I applied your neg displacement. You don't need the merge shader, this would also make it unnecessarily complicated.
I fed the output of the displacement shader as a child-function of the distribution shader. This distribution shader now controls the slope and height-restrictions.
As you can see I changed the values to fit my crater. Just experiment a bit with it to see that it works and then port this to your project.

A small side note is that I didn't expect a powerfractal to work as input for a Voronoi 3D diff scalar, but it seems it does :)
Normally I would use a "get position from texture" for the input and use a constant scalar (or a powerfractal may be, though I never did that) as seed input.

I hope things are a bit more clear now.

Cheers,
Martin
Title: Re: Using Distribution Shader On Displacements?
Post by: Tangled-Universe on January 17, 2011, 05:35:40 PM
How did it work out for you Rich?
Title: Re: Using Distribution Shader On Displacements?
Post by: RichTwo on January 18, 2011, 09:39:16 AM
Thank you Martin, and my apologies for not replying sooner.  I just took a break from Terragen - seems there are more important things to do in my life (but not much more... ;)).  I think I have found out my problem: I have a multitude of displacements going on in my current project and somehow have managed to get them crisscrossed to make them do something I don't want.  So now, it's back to square one.  I will have to completely retool what I've put together and pretty much start over.  But yes, your set-up worked, and so will Ulco's and Jason's once I strip down the nodes to the basics.  Thanks again to all for the help - this is a great community!     
Title: Re: Using Distribution Shader On Displacements?
Post by: bobbystahr on January 18, 2011, 04:14:12 PM
Quote from: Rich2 on January 18, 2011, 09:39:16 AM
this is a great community!     

HEAR HEAR!
Title: Re: Using Distribution Shader On Displacements?
Post by: Tangled-Universe on January 18, 2011, 05:13:39 PM
:)

No worries Rich.
Clean up your network-mess first and then see how it goes.
Keep my suggestion in mind in regard to how to use the compute nodes and everything should work out well.
Just let us know how it went.

Martin
Title: Re: Using Distribution Shader On Displacements?
Post by: Volker Harun on January 19, 2011, 10:37:02 AM
Quote from: Tangled-Universe on January 16, 2011, 07:35:34 AM
A small side note is that I didn't expect a powerfractal to work as input for a Voronoi 3D diff scalar, but it seems it does :)
Normally I would use a "get position from texture" for the input and use a constant scalar (or a powerfractal may be, though I never did that) as seed input.

Using a PF as input for a Noise gives you more control up to regular, but distorted, pattern. Using a PF for the scale of a Noise is a very good idea, too. But do not dare to use a PF for the seed ... else I will reach out for you in your worst nightmares ,-) ... Well give it a try, but don't be dissapointed :) ;) ;D
Title: Re: Using Distribution Shader On Displacements?
Post by: Tangled-Universe on January 19, 2011, 10:55:09 AM
I'm not sure what you mean by "control up to regular, but distorted, pattern".

I think I know the reason why a PF would work as input, because the PF itself can provide information about the "position".
If you do not have a compute node attached to the PF it will automatically use some computation as far as I know.
Which specific part of the computed network, I do not know.
Title: Re: Using Distribution Shader On Displacements?
Post by: Volker Harun on January 19, 2011, 12:58:44 PM
Quote from: Tangled-Universe on January 19, 2011, 10:55:09 AM
I'm not sure what you mean by "control up to regular, but distorted, pattern".

You can see it there: http://forums.planetside.co.uk/index.php?topic=10826.msg111579#msg111579


Sample:
(http://forums.planetside.co.uk/index.php?action=dlattach;topic=10826.0;attach=27057;image)

Quote from: Tangled-Universe on January 19, 2011, 10:55:09 AM
I think I know the reason why a PF would work as input, because the PF itself can provide information about the "position".
The position defines the colour output of the PF. If you have a Voronoi noise scaled 100 and you have a PF for the input which has a colour range from 0 to 1 will give you a boredom of an almost uni-coloured noise.
A colour range from -200 to 200 gives you a reasonale pattern.
Where TG2 shows the noise from the coordinates (-200,-200,-200) to (200,200,200). :)

Volker
Title: Re: Using Distribution Shader On Displacements?
Post by: RichTwo on January 20, 2011, 10:30:05 AM
Again I stand in awe of the expertise that proliferates here...  But in response to Martin, yes sir: it works as you can see by this image.  And it probably would have at first had I started out the right way.  My problem (and I swear I'll never do it again!) was that I just kept adding stuff onto one project in hopes I could get it to morph into something good.  Instead I created confusion.

Now, this image is not quite a finished product, nor do I consider it my crowning achievement.  But being able to achieve it is a huge milestone for me.

Now please excuse me while I go and connect a powerfractal to the seed input of the Voronoi noise node... See you in my dreams, Volker!  ;D
Title: Re: Using Distribution Shader On Displacements?
Post by: inkydigit on January 20, 2011, 11:02:59 AM
:D
sweet Rich!
Title: Re: Using Distribution Shader On Displacements?
Post by: Kadri on January 20, 2011, 11:17:54 AM
Looks interesting :)
Can you render it bigger ?
How long did this one take to render Rich2?
Title: Re: Using Distribution Shader On Displacements?
Post by: Henry Blewer on January 20, 2011, 04:36:33 PM
Cool looking pinnacle! I am glad this is working.