Getting shaders to be affected by slope - doesn't seem to work sometimes

Started by moodflow, December 31, 2006, 07:08:52 pm

Previous topic - Next topic

moodflow

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?
http://www.moodflow.com
mood-inspiring images and music

Tim O'Donoghue

If you post the TGD file, maybe someone can figure out what's happening with the scene.

Oshyan

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

moodflow

Here are some screens of what I have going on.  I wonder if its because I imported a custom .ter file?
http://www.moodflow.com
mood-inspiring images and music

moodflow

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.
http://www.moodflow.com
mood-inspiring images and music

moodflow

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 :-(

http://www.moodflow.com
mood-inspiring images and music

FrankThomas

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

moodflow

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.

http://www.moodflow.com
mood-inspiring images and music

moodflow

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.
http://www.moodflow.com
mood-inspiring images and music

FrankThomas

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.

carloz323

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

PatrickH

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

moodflow

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.
http://www.moodflow.com
mood-inspiring images and music

Matt

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
Just because milk is white doesn't mean that clouds are made of milk.

PatrickH

Cool- thanks for the workaround. Changing the colour to something other than white affects the opacity of the stones right?  I think so.

Patrick