simple shape location bug?

Started by Dune, June 19, 2011, 03:27:36 AM

Previous topic - Next topic

Dune

Is this a bug, or did I do something wrong? When placing a simple shape mask at 0/0/0, it (just a quarter of it) ends up at the corner of the generated height field, which is centered, and not centrally. Won't make a difference if you change the position key on the simple shape.
To get it centered you'd have to add half the size of the height field as X and Z to the position of the simple shape.

Tangled-Universe

I'm probably not awake yet, but I don't see a problem here?
The circle's centre is at position 0,0,0 and the heightfield's centre seems to be there as well, just as expected according to these settings.

jo

hi Dune,

The Heightfield generate node also has shader position settings on its "Use shader" tab. Make sure that's set to the center rather than lower left too.

Regards,

Jo

Matt

Ditto T-U. Your heightfield appears to be centred at 0,0 and your simple shape shader is also centred at 0,0,0 so it should be in the centre of the heightfield, which it is.

I wonder if you ran into the bug where the simple shape shader's bounding box doesn't update correctly - sometimes you have to force the 3D Preview to refresh.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Quote from: jo on June 19, 2011, 07:44:46 AM
The Heightfield generate node also has shader position settings on its "Use shader" tab. Make sure that's set to the center rather than lower left too.

This would only affect the data that is put into the heightfield, not the position it is rendered at. The settings in the generate node control the position of the 'window' into the shader that generates it.
Just because milk is white doesn't mean that clouds are made of milk.

jo

Quote from: Matt on June 19, 2011, 12:08:18 PM
This would only affect the data that is put into the heightfield, not the position it is rendered at. The settings in the generate node control the position of the 'window' into the shader that generates it.

Now I'm confused. Isn't what's going on all about putting data into the heightfield?

My response was just based on quick messing about so it works but it's not the correct solution I guess. But what is the correct solution here? Because something is working in an unusual fashion and I'm not sure what it is. I tried this with an Image map shader too, just to check it wasn't something about the Simple shape shader. I did this:

- Start a new scene
- Set Heightfield shader 01 to use Position centre.
- Create an Image map shader and set it to the same size as the heightfield. The position will be 0,0,0 like the heightfield already. Set it to use Position centre and Plan XY projection. Turn on displacement and set the amplitude to 1000.
- Click the Generate Now button of the Heightfield generate node.

You'll only get relief in the lower left corner of the heightfield, which is what Dune was seeing, even though the Image map shader is exactly overlaying the heightfield.

To get the relief that you'd expect in the heightfield with this setup you can go to the Use shader tab of the Heightfield generate node and click Position centre. That gives the results one might naively expect. So this does work for the simple case of one shader being placed over a heightfield, but I agree it might not be what you want for multiple shaders like Dune is using. It will also work with Position lower left if adjust the position appropriately.

The intuitive way this would happen is that the Heightfield generate would capture the data as its shown in the preview, for example if you position a shader in the centre of the heightfield that's what you'd see in the heightfield. However it doesn't necessarily work that way it seems.

Regards,

Jo


Dune

#6
Ah, I'm glad I was right. I'll try out the shader tab position center, but actually I never looked at it, just plugged my shaders in..... well, that works like a charm. Thanks!

Matt

Ah, I should have looked more closely at your screen grab Dune. I completely missed that the first time. Yes, if you're using a shader to generate the heightfield, you need to set the same position settings in both the Heightfield Generate node and the Heightfield Shader node.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Quote from: jo on June 19, 2011, 10:24:58 PM
The intuitive way this would happen is that the Heightfield generate would capture the data as its shown in the preview, for example if you position a shader in the centre of the heightfield that's what you'd see in the heightfield. However it doesn't necessarily work that way it seems.

Yes. The problem currently is that heightfield nodes themselves don't contain any information about their position in space, only their scale. (The new georeferencing feature is an exception.) The only time the heightfield gets position is when it is used by a Heightfield Shader.

To allow heightfields to know their own position we would have to set their position in the heightfield node(s) and remove/ignore the position settings of the Heightfield Shader. That's basically what I've done with the georeferencing options (which I had to in case the georeferencing info is read from the file), and in future we will probably go in that direction with general placement too. It would make the process of converting between shaders and heightfields easier. Repositioning with the Heightfield Shader would still be optional, for backward compatibility and to continue to allow multple Heightfield Shaders to render a shared heightfield (although even that problem could be solved with a new heightfield operator to reposition heightfields).
Just because milk is white doesn't mean that clouds are made of milk.