4
$\begingroup$

I'm trying to displace a plane using (a) a height map (greyscale) image texture to set the height, such that each pixel of the height map determines the height of a corresponding column and (b) another (colour) image texture to set the colour of each column. I'm essentially looking to create a 3d bar chart (or column chart if you prefer) where I can set the height and colour of each column.

I'm having two problems:

First, the colours of the sides of the columns aren't set by the colour of the pixel at that location, but rather are sometimes that colour, and sometimes the colour of a neighbour - as shown e.g. in the areas I've circled in red here:

enter image description here

Secondly, the columns aren't quite vertical, but rather taper towards the top. You can't see that so easily above, but when I use a higher resolution height map, (e.g. 4000x2000 pixels), it's more apparent, e.g.:

enter image description here

Any advice on the above problems much appreciated. I'm using a sub-surface modifier, with adaptive subdivision, and the dicing scale set as low as Blender allows (0.1).

Should I, for example, instead be creating a giant mesh at say 4 times the resolution of the height map? The problem is for a 4000x2000 height map, that is going to be rather large...

Many thanks

John

Edit - grids used for heightmap and colour are below (although they're only 10x10 pixels so may not be visible in the post)

colour grid heightmap grid

$\endgroup$
4
  • $\begingroup$ pls provide blend file $\endgroup$
    – Chris
    Mar 2, 2022 at 10:04
  • 2
    $\begingroup$ and a hint: geometry nodes were made exactly for these scenarios. And it is pretty easy to do that. Or aren't you open for that? $\endgroup$
    – Chris
    Mar 2, 2022 at 10:05
  • 1
    $\begingroup$ Thanks for the quick response. I've attached the blend file at the link below (if there's a better way of sharing please shout). Re using geometry nodes, very open to that if they can use image textures as their source! Many thanks. dropbox.com/t/w7GeW4yGsyaSTRTi $\endgroup$
    – JohnH
    Mar 2, 2022 at 10:10
  • 1
    $\begingroup$ First of all, of course the columns are not vertical. That's because a plane is built by vertices having some distance between each other. A vertex by itself has no dimension, so it gets either one color or the other. Since two vertices next to each other with different colors (heights) always have a space between them, the column will always "taper". And when the color switches between vertices, the color change will take place somewhere between those vertices, i.e. on the side of a wall. If you want one column per pixel it might be better to make each its own cube, see Geometry Nodes @Chris. $\endgroup$ Mar 2, 2022 at 10:11

1 Answer 1

4
$\begingroup$

if you use this node tree:

enter image description here

shading tree:

enter image description here

GN modifier:

enter image description here

you will get:

enter image description here

As you can see i used a picture of a "1" for the height, and yeah, a movie, not an image as colorizer ;) of course, for an image it is the same without plugging the scene time into the frame.

$\endgroup$
6
  • $\begingroup$ Thank you so much! This looks great. Just to follow up, is there a way of scaling the cubes vertically so their height scales rather than their position (so e.g. you don't have a space underneath the '1' in your image? Also, I'm new to geometry nodes, and struggling to get this to work. Would you be able to share the blend file please? E.g. when I try to replicate what you showed, the heights don't correspond to my heightmap, and I can't get the colour output attribute to show. Are there any particular tutorials you recommend to help on this? Thanks again. $\endgroup$
    – JohnH
    Mar 2, 2022 at 11:07
  • 1
    $\begingroup$ Pls provide your blend file, I will check it. Important: do file - external data - pack resources before uploading. And please check the checkmark left of my answer if it helped you. Thanks. You can plug in the result of the color in scale instead offset. $\endgroup$
    – Chris
    Mar 2, 2022 at 11:11
  • $\begingroup$ Just search for some beginner geometry nodes tutorials on yt. Me personally I love Polyfjords tutorials. Erindale makes great tutorials too, especially for GN. $\endgroup$
    – Chris
    Mar 2, 2022 at 11:12
  • 1
    $\begingroup$ Re checking my blend file - that's very kind of you, thanks. I will share shortly. Have ticked the checkmark. Thanks again. $\endgroup$
    – JohnH
    Mar 2, 2022 at 15:04
  • 2
    $\begingroup$ You are welcome! $\endgroup$
    – Chris
    Mar 2, 2022 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .