Planetside Software Forums

General => Terragen Discussion => Topic started by: mhaze on August 10, 2009, 12:24:50 PM

Title: Displacement of imported obj files
Post by: mhaze on August 10, 2009, 12:24:50 PM
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
Title: Re: Displacement of imported obj files
Post by: Matt on August 12, 2009, 05:18:01 PM
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
Title: Re: Displacement of imported obj files
Post by: mhaze on August 12, 2009, 06:48:51 PM
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
Title: Re: Displacement of imported obj files
Post by: Matt on August 12, 2009, 07:10:45 PM
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
Title: Re: Displacement of imported obj files
Post by: mhaze on August 13, 2009, 04:47:02 AM
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
Title: Re: Displacement of imported obj files
Post by: domdib on August 13, 2009, 04:53:14 AM
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.
Title: Re: Displacement of imported obj files
Post by: mhaze on August 13, 2009, 05:11:56 AM
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
Title: Re: Displacement of imported obj files
Post by: Henry Blewer on August 13, 2009, 05:15:38 AM
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)
Title: Re: Displacement of imported obj files
Post by: mhaze on August 13, 2009, 05:31:07 AM
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
Title: Re: Displacement of imported obj files
Post by: Matt on August 13, 2009, 03:25:45 PM
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
Title: Re: Displacement of imported obj files
Post by: Henry Blewer 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?
Title: Re: Displacement of imported obj files
Post by: mhaze on August 13, 2009, 04:31:23 PM
so scaling the object before importing the object should give the correct results? Or better still get the scaling of the PF right.

Mick
Title: Re: Displacement of imported obj files
Post by: Matt on August 13, 2009, 04:46:28 PM
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.
Title: Re: Displacement of imported obj files
Post by: Matt on August 13, 2009, 04:46:56 PM
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.
Title: Re: Displacement of imported obj files
Post by: Henry Blewer on August 13, 2009, 08:06:50 PM
That helps! Thanks.
Title: Re: Displacement of imported obj files
Post by: mhaze on August 14, 2009, 06:28:07 AM
Thanks Matt

I've got working displacement!!!! :D :D :D