Planetside Software Forums

General => Terragen Discussion => Topic started by: moodflow on December 31, 2006, 07:08:52 pm

Title: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: moodflow on December 31, 2006, 07:08:52 pm
Well I thought I figured it out, but I guess I didn't.  I cannot get the fake rocks shader to map properly to a .ter file I imported, and then be affected by the slope (ie only applying fake stones to areas of less slope or vice versa).

I've tried using the distribution shader, and all seems completely logical, but still no luck.  The "fake stones" don't behave and just place themselves whereever.   

Any ideas?
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: Tim O'Donoghue on December 31, 2006, 07:12:53 pm
If you post the TGD file, maybe someone can figure out what's happening with the scene.
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: Oshyan on December 31, 2006, 07:18:57 pm
Yes, please post the .tgd file or an image of your network. The quick steps that I just used to test this and verify it's working (it is) were as follows:

Generate terrain (if necessar)

Go to Shaders layout

Add Layer->Surface Layer->Fake Stones Shader

Change color to red (for visualization purposes)

Check Blend By Shader

Click the ... button to the right of the Blend Shader entry box to bring up a menu

Select Create New Shader->Colour Shader->Distribution Shader V4

I then adjusted constraints in the Distribution Shader and it seems to work fine.

- Oshyan
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: moodflow on December 31, 2006, 07:24:19 pm
Here are some screens of what I have going on.  I wonder if its because I imported a custom .ter file?
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: moodflow on December 31, 2006, 07:26:26 pm
It still wants to place the fake stones on very steep (and in some cases inverted) slopes, even with those settings in the above post.

Thanks for the help so far.  I was surprised it didn't work immediately.

unfortunately, to post the tgd file, I'd likely need to post the .ter file, which is kinda large.
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: moodflow on December 31, 2006, 07:30:31 pm
Also, the distribution shader has its own color it wants to apply called 'diffuse color'.  If I create a new surface layer (not surface shader), it does include an option to turn this color off, and let things show through from below.  However, this still didn't help with the slope :-(

Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: FrankThomas on December 31, 2006, 08:54:02 pm
I have a sneaking feeling your distribution shader is in the wrong place.  I've had this working fine - I posted  my last effort earlier - I'll see if I can dig out the nodes I used

[edit]
Here you go - that was also a custom terrain.  Generated from DEMs of the Grand Canyon
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: moodflow on December 31, 2006, 09:12:07 pm
Thanks for the inputs so far.

As it turns out, it "is" working for distribution based on slope, but the stones lose the full wrap of texture or color.  It seems to place it only on their top face, very strange.  If you do a quick render, you can see how the stones aren't colored all the way around.  If you pull out the distribution shader, the stones are colored all the way around BUT are not affected by slope (which it what I am trying to achieve).  Actually, Terragen's ability to add stuff based on slope or altitude is one of its main benefits in my opinion.

Here is a simple sample tgd file of whats going on.

Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: moodflow on December 31, 2006, 09:31:36 pm
ROFL!  Ok I found out the deal.   ::) Not only is it placing the stones via slope, its also placing the textures based on that same slope on the stones themselves!  With this, they don't get covered with the texture or color all the way around.

Now I just need to find out a way around this.
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: FrankThomas on December 31, 2006, 10:54:18 pm
Could be that the distribution shader should be before the fake stones one - the way it is now, the distribution looks like it's applied to all the shaders (as it's the last in the list) hence it's acting on the stones (if I'm reading the flow right) try putting the displacement as an input to the fake stones.
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: carloz323 on January 01, 2007, 03:19:54 pm
The distribution shader in combination with the image map shader doesn't seem to work with me either... it affects both the distribution of the stones and the image mapping process


C
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: PatrickH on January 02, 2007, 05:30:45 pm
Anybody figure this out?  Is it a bug?  If you constrain fake stones by slope in the distribution shader, the color or image of the stones also has those slope constraints on the stones.

Patrick
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: moodflow on January 02, 2007, 06:05:11 pm
Quote from: PatrickH on January 02, 2007, 05:30:45 pm
Anybody figure this out?  Is it a bug?  If you constrain fake stones by slope in the distribution shader, the color or image of the stones also has those slope constraints on the stones.

Patrick


I couldn't have said it better. 

I still haven't figured out a way around this.  It will likely require a modification to the shader options.
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: Matt on January 02, 2007, 06:16:32 pm
This can be fixed by using a Surface Layer instead of a Distribution Shader and changing the slope key to "Terrain Normal" (it defaults to "Final Normal"). It is an oversight that we haven't added that option to the Distribution Shader too. I don't want to encourage use of the Surface Layer when a Distribution Shader is more suitable (and slightly more efficient), but in this case it is the best solution.

Whether you use a Surface Layer or a Distribution Shader for this kind of distribution control, you always need to give it a white colour.

Matt
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: PatrickH on January 02, 2007, 08:15:18 pm
Cool- thanks for the workaround. Changing the colour to something other than white affects the opacity of the stones right?  I think so.

Patrick
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: Xerraire on January 03, 2007, 06:51:25 pm
I've had some luck by doing this, it seems, wrongly.

I had a base layer which I made two colors, then a new surface layer where I added a image on the layer.
I added next a surface shader, fake rocks.

On the one, I see that I had no control over the rocks where they went, and it looks awkward to see them climb up one side, but I wasn't sure how to solve that. The second, there wasn't that problem.

Now I have tried it the correct way, but not with as good results as seen here. Making the color white didn't seem to help, but ticking turn off color did...
Title: Re: Getting shaders to be affected by slope - doesn't seem to work sometimes
Post by: carloz323 on January 06, 2007, 12:56:37 pm
Ok Guys, finally got it working!

Thanks to MoodFlow and Matt for the basic tgd and the comments about the distribution shader.

Wanna say that terragen 2 is soooo cool!! Thanks to all the developers/staff.

Added are a final full render and the tgd-file. I use a local stone-image in the image mapper so the tgd will give an error on loading. Just click ok and add ur own stone surface image.


Thanks all,

Carloz