Displacement of imported obj files

Started by mhaze, August 10, 2009, 12:24:50 PM

Previous topic - Next topic

mhaze

I've modelled a hero rock that I need to use in terragen - exported it as an obj file and imported it into Terragen, so far so good.

I can apply an imagemap and displace that. But to get the rock to fit I'd like to displace it with functions.

Terragen does not want to know.

Am I doing something wrong or is this not possible in terragen?

Mick

Matt

#1
If you can displace it with an image, it should be possible with functions too. Just plug your functions into the displacement function on the default shader and play with the displacement multiplier. Colour or scalar values generated by the functions are then used to generate displacement.

There are some issues with imported geometry and displacement, but anything that works with an image should work with functions too.

If you just want to use the built-in displacement shaders, simply connect those shaders anywhere before or after your default shader (or whatever other shaders you might be using).

Matt
Just because milk is white doesn't mean that clouds are made of milk.

mhaze

Thanks for the reply matt, but I just can't seem to make it work. I've tried flipping normals, putting the obj file through poseray - all sorts but nothing displaces the mesh, maybe a simple example would show me the error of my ways!

Mick

Matt

Use a Power Fractal Shader to displace the object, no other shaders. Does that work? Next, try using a Default Shader with the Power Fractal plugged into its displacement function and set displacement multiplier to 1. That should give you different results, because it uses the colour generated by the fractal rather than its displacement, but you should get results.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

mhaze

Hi I assume all this is done in the internal network of the object node - if so does not work :(

I must be doing something stupid but I cant see what!

Mick

domdib

It's a long shot, but is your internal network connected to the final surface shader? See this thread (http://forums.planetside.co.uk/index.php?topic=6779.msg71943#msg71943) for a problem I had with a TGO.

mhaze

#6
OK I've got displacement the PF settings must relate to the original size not the scaled size of the object file. I had to use huge displacement numbers to get displacement. The results were not worth the effort as the obj mesh simply broke up.

domdib, I don't think the two problems are related.

I might try converting the obj to TGO and play then.

Mick

Henry Blewer

Did you use image maps in the modeller program? Use PoseRay to make any corrections to the image maps. They may be easier to handle than the nodes. (I am just learning this also)
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

mhaze

#8
I'm getting displacement but it has no relationship to the PF driving it - it seem to be simply inflating the object

I'd attach the obj and tgo files but they are too big

Matt

If the object has UVs, then the power fractal will be working in UV space, not world space. The UV values range from 0 to 1. For the fractal's scale parameters you'll want to use values less than 1 to render these features smaller than the object. However, displacement amplitude is still calculated in metres in world space so you need to think about how big the object is in world space after any scaling you apply.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Henry Blewer

Matt, then scaling up an object does not alter the shape, but does alter the size? In other words, an imported object which begins at 1 meter diameter, would then be 10 meters, if the scale factors were set to 10?
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

mhaze

#11
so scaling the object before importing the object should give the correct results? Or better still get the scaling of the PF right.

Mick

Matt

#12
It doesn't matter whether you scale the object before importing or scale it in Terragen. You still need to choose a displacement amplitude/amount that looks right for the size of the object as it is rendered, because the displacement amount doesn't automatically scale when you scale the object.

The scale values (feature scale, lead-in scale, smallest scale) will work in UV space, so they will scale automatically when you scale the object, but displacement amount doesn't.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Quote from: njeneb on August 13, 2009, 03:57:46 PM
Matt, then scaling up an object does not alter the shape, but does alter the size? In other words, an imported object which begins at 1 meter diameter, would then be 10 meters, if the scale factors were set to 10?

Yes, if all three XYZ scale factors are the same.
Just because milk is white doesn't mean that clouds are made of milk.

Henry Blewer

http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T