Any help you can give here or on reddit would be appreciated, thanks.
Hmm,
no idea what you are after (strange mapping) but if you want the voronoi colours to change the normals you could do something like this.
Iām trying to take the center point of each voronoi cell, sample the normal of the object at that point and colour the whole cell that colour.
Thatās almost an exact replica of my second example image on reddit. It is block colour as intended, however, I want to be able to manipulate the voronoi and have the colours still be right for the normals. If I change the mapping on the voronoi to anything but object or normal (stretch it any way etc) the colours get messed up.
Well the way you formulate your intention its not possible, no. You cant sample the normal in a shader and propagate it to other pixels. Thats not possible by the way shaders work.
Can I achieve the exact same effect through other means? Iāve looked into using geometry nodes and doing the voronoi there, but then the voronoi is tied to the vertices and therefore is quite low res.
Not really, youād have to bake the normals in one pass and composite
I am not sure what 3d shape we are really talking about, its not possible if your mesh isnt aligned to the voronoi cells, but if just split the mesh per voronoi cell and store the normal as attribute.
Sorry I did not see that read more button
I donāt understand the purpose of this shader.
if you want to transform voronoi cells into angle, then into normal map, itās possible:
Thatās going in the right direction, but with normal maps, youāre adding normals to the existing geometry normals. I donāt want to add. I basically want to smear the normals into cells, but I want the cells to be stretched. Iāve been told so far on here itās not possible, but I feel like there must be a way to get this effect. Perhaps if voronoi textures werenāt even used, I donāt know.
Does anyone know if this is possible with OSL?
For doing it with OSL, you need to know exatcly what you want to doā¦
I confess that after reading all your posts, I still donāt have a clear idea of what youāre trying to achieve.
Just to get things clear: Do you want each cell to instead of a color, to output a normal vector (maybe the normal vector at the center of each cell)?
Is that it?
Yes, essentially. Usually you could do this by just plugging the normal output of a geometry node into the vector input of the voronoi, but I want to have a different kind of mapping for the cells, but still retrieve the normal from the center of those mapped cells.
I donāt know how you isolate the cells and their center to sample the normal at that position on the geometry
Youāll need to use a 2D voronoi for this, and UVmapping as youāre vector space.
This is because, having a 3D voronoi will produce cell centers that arenāt on the objects surface, and that makes a cell to have multiple possible normals to choose from.
Youāll also need to bake the normal map (object space) into a texture. This is because you cannot ājumpā from one sample position to another without crampling your shader completly, and you need to be able to sample a specific coordinate, and thatās easy with texture files.
Then you can just use a setup similar to this one:
Thatās cool if that works with manipulating the UV map too. Unfortunately it doesnāt work for what i want to do because Iām going to be animating the W value of a 4D voronoi.
It would be cool if there was some way to apply the voronoi texture like a filter on an image, you map the voronoi and then the image with itās own mapping is smeared into block colours for each cell.
I donāt know if thatās possible with shader nodes or if that is even something possible in compositing. My best guess would be that OSL could provide the customisability needed to achieve such an effect, but Iām not sure.
Itās not technically Voronoi, but the Kuwahara filter in the compositor allows you to mostly do this. What you want to do isnāt possible by any method, but this will allow you to animate the cells, at least
There is no real difference between OSL and other Shading Languages in this regard. You cant sample the normal of distant values.
Geometry nodes give you in principle one more level of indirection, but they work on vertex data not pixels. So get your idea to align with that if thats what you want.
You need a mesh that aligns with your voronoi. You can then use a finer mesh version it to approximate your initial shape better in a next step, but still its not pixelbased. And the normal updating is in this case in the geometry nodes setup.
3D cells will just break any logic youāre trying to formulate (4D is just 3D with the random factor having itās own dimention).
You can use a 2D voronoi and drive the randomness with a third dimentionā¦ But for that youāll need to use OSL, as we donāt have that texture builtin.
Thatās the sameā¦ In my example I just used the baked normals but you can plug any image into it:
And to be honest, if you want a more concrete solution for your problem, you shouldnāt hide any details from us. What would be the purpose of such shader? Where are you planning to use it, in what context?
In my experience, anytime that someone occludes the final objective when asking a fuzzy question, results in pure confusion and misunderstandings.