Image to restrict terrain

Started by Sengin, June 08, 2008, 07:15:35 PM

Previous topic - Next topic

Sengin

Say you have an image of a black circle on a white background and you import it to an image shader.  Is there a way to use this image so that a power fractal will only generate terrain in this black circle?  (attaching the image shader to the blending shader input of the power fractal shader doesn't work, even when PlanY and through camera projections are used in the image shader).

Basically, I'd like a circular-ish island in the middle of some water and figured using a power fractal would be easiest to get the height for it, and an image shader to restrict the XZ values being used.

Thanks.

darthvader

first of all, the white is where the power fractal will be used so you should most likely invert your image. I have had success by giving the fractal an image map for it's blending shader. Assign the image map to a second camera with 'through camera' projection and have it pointing straight down at the ground with a higher altitude for a bigger projection map.

i hope that helps :)

Sengin

That didn't seem to help...from the top down in the nodes I had a camera with an input to the image map's projection camera, the output of the image map shader to the blending shader input of the power fractal, and the ouput to the compute terrain.  Nothing changed at all and the scene was rendered as if it was only the power fractal.

Sengin

Any other thoughts or suggestions?

rcallicotte

Darthvader is correct in how this works.

If you do a search, this has been addressed in detail recently.
So this is Disney World.  Can we live here?

Sengin

I did a search before creating this thread and I didn't find anything that worked.  Here is my terrain node network.  Is this what was described?

red_planet

Hi..

Quick and dirty guide

Right click in the node map...

Create Shader - Image map Shader. (point to your masking image to select it)

Set image map shader to Plan Y

Go to Terrain Tab...

Add Terrain - power fractal...

In Terrain settings Panel..

Click Blend by Shader...Click fit blendshader to this .. use browser (the button with three dots) to assign shader..image map shader...

Voila !!

Hope this helps....

Chris


Tangled-Universe

Or...

- Create camera and put it on the spot where you want the circle to appear.

- Create distance shader and set distance colour (white) to the desired diameter for the circle.

- Plug camera into distance shader, now the camera is surrounded by a white circle, this will be your mask then.

- Plug the distance shader into the blendfunction of the powerfractal and you're good to go :)

I also use this to restrict my populations for being too close to my camera (by inverting the blendshader then of course)
Hope this will help!

Martin

Sengin

Quote from: red_planet on June 12, 2008, 01:33:59 PM
Hi..
Quick and dirty guide
Right click in the node map...
Create Shader - Image map Shader. (point to your masking image to select it)
Set image map shader to Plan Y
Go to Terrain Tab...
Add Terrain - power fractal...
In Terrain settings Panel..
Click Blend by Shader...Click fit blendshader to this .. use browser (the button with three dots) to assign shader..image map shader...
Voila !!
Hope this helps....
Chris

Well, it helped a lot actually.  But there's a problem, though I'm not sure to what part it's coming from: my image, compute terrain/power fractal, or the image shader (see attached image).

Also, when moving the quick view while it is rendering while having an image shader, it crashes unless the quick view is paused (but I think Matt knows about this already).

red_planet

Hi..

I experienced similar problems.. they went away when I feathered the edges in the mask image...Anti Aliasing any boundaries may also help. I suspect it's the discrete pixel boundary in the source mask image that is, for whatever reason, responsible for generating extreme displacement. Of course I may also be talking complete hogwash !

Rgds

Chris


Tangled-Universe

Quote from: red_planet on June 13, 2008, 05:28:27 AM
Hi..

I experienced similar problems.. they went away when I feathered the edges in the mask image...Anti Aliasing any boundaries may also help. I suspect it's the discrete pixel boundary in the source mask image that is, for whatever reason, responsible for generating extreme displacement. Of course I may also be talking complete hogwash !

Rgds

Chris



I thought this has to do with the "unpremultiply color" option, but I may also be talking hogwash like you said ;)
By the way, with my approach you won't have these problems.