Add Triplanar texture coordinate type#1
Closed
jakeblakeley wants to merge 2 commits into
Closed
Conversation
…ayer_type check_layer_source added the source node to the layer tree instead of the source group tree, so toggling a channel on a layer that uses a source group (e.g. with smooth bump enabled) could recreate the source with a blank image. Redirect it through get_source_tree. replace_layer_type removed the source's input link from the layer tree rather than the source group tree that actually owns it, raising "Unable to locate link in node tree" when changing the type of a layer that uses a source group. Use source_tree for the removal.
Projects the source along the three object axes and blends them by the surface normal, so it works with any source (images and procedural textures alike) in both Eevee and Cycles, back to Blender 2.80. The source group is wrapped in a per-entity node tree that instances the source three times with swizzled object-space coordinates. Color always blends all three projections to avoid stretching, while the per-side controls only fade coverage through the alpha weights. Works with smooth bump (the neighbor sources share the wrapper) and layer/mask duplication. Controls, exposed on both layers and masks: - Projection Blend: transition softness between projection axes - Expand: grows shown-side coverage to counteract fading when sides are hidden - Show +X/-X/+Y/-Y/+Z/-Z: per-side visibility, selected by the normal direction All the weight math is built from scalar Math, Separate/Combine XYZ and Mix nodes so it evaluates identically in both engines with no version-specific fallbacks. Triplanar utility node groups are generated in lib.py following the existing programmatic node group convention.
Owner
Author
|
Superseded by ucupumar#409 — moved directly to the upstream repo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Triplanar texture coordinate type for both layers and masks. It projects the layer/mask source along the three object axes and blends the three samples by the surface normal, so it works with any source — images and procedural textures alike — in both Eevee and Cycles, back to Blender 2.80.
Controls (layers and masks)
How it works
When a layer or mask uses the Triplanar coordinate, its source group is wrapped in a per-entity node tree that instances the actual source three times with swizzled object-space coordinates. This is a little expensive on weaker hardware so we may want to warn folks. Color always blends all three projections (so there is no stretching on faces that tilt away from a single axis), while the Show/Expand controls only fade coverage through the alpha weights.
get_source_tree/get_mask_treetransparently unwrap the wrapper, so the rest of the addon (modifiers, linear nodes, baking, source editing) is unaffected.It composes with the existing machinery: smooth bump reuses the same wrapper for its neighbor sources, and layer/mask duplication copies the inner source tree so instances are not shared. You can technically get this effect with the fake lighting approach, but its quite a long setup. This also exists in similar software like Substance Painter.
All the weight math is built from scalar Math, Separate/Combine XYZ and Mix nodes, so it evaluates identically in both engines with no version-specific fallbacks. The triplanar utility node groups are generated in
lib.pyfollowing the existing programmatic node-group convention (likeget_smooth_mix_node), so no changes to the binarylib*.blendfiles were needed.I also included an expand slider since this is useful to get more of a certain axis, but it might be a bit much as you can get the same effect in other ways.
Commits
check_layer_sourceandreplace_layer_type. Both are pre-existing issues affecting any layer that uses a source group (e.g. with smooth bump), independent of this feature; split out for separate review.Testing
Verified on Blender 5.2: node-graph validity, coordinate switching round-trips without leaking wrapper trees, procedural and image layers/masks, smooth-bump interaction, layer type changes, duplication, and save/reload. Rendered per-face parity checks in both Eevee and Cycles confirm the projection, per-side hiding, and expand behavior. Compatibility with 2.80 is by construction (only nodes and Vector Math ops available since 2.80 are used). Test on Nvidia and Mac GPUs.
You might need to set "shade smooth" on low poly meshes to see the effect properly. Here's screenshots of the effect working with textures, as a mask, and with procedural effects:


