Keep Procedural texture accurate by ignoring origin?

Hi
I am working on my submission for the kinetic rush challange but get a little problem.
I added some destructible pillars created with cell fracture in Blender but becuse i use object texture coordinate to accurately generate the PBR on the meshes. Also i want to add some descrtion to the bridge and on the bridge is it more visible.


The problem is, that the fractures are making a new origin what destroys accuracy but i cant change the origin, becuse it need to be in center of the fractures and act as anchor point if i remember correctly. How can i change the nodes, that the texture coordinate is by the object but ignores the position of any origin?

1 Like

Use Generated instead of Object

already tried but not working

The problem with the fractures is that even if you change the origin reference to something else, the texture will slide when your fractured parts move out of place…

So your best option is to bake the textures (and you can use an empty as the origin of all parts)… or, manually add the transformation from the fractured parts’ origin to root object’s origin (using the Mapping node with the object coords).

1 Like

as long i no adding a object in the object bar of the texture coordinate, the texture will not slide. And i wanted to avoid baking the textures or do UVs, becuse that means i need to fracture all again and delete all the baked stuff.
It must be possible to solve this with nodes, I thought everything was possible with nodes?

Sure… but then your reference origin is binded to each fracture shard, which is not what you want.
And if baking isn’t an option, then python is… And this is how it goes:
You need to store the original relative position of the root object in each shard, as an Object Custom property.
Then you use that property with the help of the Attribute node to move the shard’s origin in the material.

Having all shards selected and the original object as active, run this script:

import bpy

root = bpy.context.active_object
selected_objects = bpy.context.selected_objects
selected_objects.remove(root)

for shard in selected_objects:
    shard['RootOrigin'] = root.location - shard.location

And in the material for the shards, use this setup as your new ‘object coordinates’:

3 Likes

Oh no, python my endboss, anyway thanks so far but idk how to make this costum property? I just know how to use it for some rigging stuff.

Just copy the script above into a new Text in the Blender’s Text Editor,
Select All Shards plus the Original Mesh as the Active object,
And Run the Script (the ‘play’ icon in the Text Editor)
The script creates the Custom Property automatically!

Setup the material and it’s done.

Otherwise you need to do this manually for each piece of the fracture alone. (or live without it!)

2 Likes

Thanks you so much, i wish there was an option in the texture coordinate for no needs of scripting but at least this way is not that complicated.
Have a nice day! ^^

Gern geschehen.
In my opinion, this is something that should be part of the CellFracture, as an option…
I rarely needed this for anything else.

1 Like

Damn at the first look it was good but still there are the errors. D:
Did i something wrong i just not notice?

Do you have transformations applied?

Select all shards, Ctrl+A > rotation, and see if it fixes the problem.

If i remember correctly, CellFracture copies the rotation from the cell into the shard.

I thought you had taken this into account, because the rigid bodies simulation is destroyed when the position is applied. The fractures glitching around. D:

Just the rotation and possibly the scale (if the rotation doesn’t fix)… The position is not to touch.
Can you send me a scene with just one of those columns, shards included.
No need for anything else (no textures, no other objects, etc). If i know what values are in the objects, I may be able to fix those problems also in the material.

Alright, here try around.
Hope the texture shows up, becuse i use the Substance Painter Add-on to be able to load SSP materials into blender.
And i am using 3.6 btw.

Somehow the parenting you have is messing with my initial logic… I wasn’t accounting for that.

If I unparent all the shards first and call the script, then it works…

So I changed the script a bit, and it now removes the relations with the root object, stores the property and reparents everything again.

As the shards are all linked to the parent, there’s also no need to select anything else… just the parent will do.

So, step by step with the scene you posted (will be similar for the rest of the objects in your animation)

  • change the material
  • select the ‘Construct.006’
  • run the new script.
import bpy

root = bpy.context.active_object
origin = root.location

selected_objects = root.children

for shard in selected_objects:
    bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')
    shard['RootOrigin'] = origin - shard.location
    shard.select_set(True)
    bpy.ops.object.parent_set(type='OBJECT', keep_transform = True)
2 Likes

Yoo it works now, thank you so much buddy! ^^