Fix #115460: EEVEE-Next: Missing bind when drawing curves #121064
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#121064
Loading…
Reference in New Issue
No description provided.
Delete Branch "Jeroen-Bakker/blender:eevee/fix/missing-curve-texture-bind"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When drawing hair/curves the material shader has a "a" texture slot,
but this slot was never bound to a texture. This PR fixes this by
adding a default texture to it and when available tries to bind
CD_AUTO_FROM_NAME resources.
This part seems to be not implemented when the new curve rendering
was added.
CD_AUTO_FROM_NAME
was never considered and therefore thelayer could not be found and the sampler could not be found.
Fixes #115460
EEVEE-Next: Fix missing texture bind when drawing curves/hairto WIP: EEVEE-Next: Fix missing texture bind when drawing curves/hairMoving to WIP, as it might hide other issues as well.
WIP: EEVEE-Next: Fix missing texture bind when drawing curves/hairto EEVEE-Next: Fix missing texture bind when drawing curves/hairEEVEE-Next: Fix missing texture bind when drawing curves/hairto Fix #115460: EEVEE-Next: Missing texture bind when drawing curvesFix #115460: EEVEE-Next: Missing texture bind when drawing curvesto Fix #115460: EEVEE-Next: Missing bind when drawing curves@HooglyBoogly do you have any input on this?
To be honest I don't really understand the context or the need for separate "input name" and "attribute name" variables, or why the API is set up in a way that requires us to store both of them. My instinct is that it's more complicated than it needs to be, but yeah, I'm definitely missing something.
Gpu materials can be shared between multiple objects. Curves but also other geometry. Each object can have an active uvmap that is differently named.
We don’t want to recompile the shaders based on the geometry. So this pr introduces a mapping system.
This is specific for hair as mapping attributes for meshes is part of the vbo api (aliasing).
For hair we have a refine shader that can create texture buffers. We also don’t want to generate too much texture buffers when the active uvmap is also accessed by name in the same shader.
I am open for other solutions as well. I do thing when the curves.active_uvmap is available we can reduce some lookups during this process. But I am not sure if that attribute should be used in this case….
I would consider adding the
CD_AUTO_FROM_NAME
support for new hair types orthogonal to this fix.Adding the missing binds using default dummy texture seems fine to me for now. If we have to fix the discrepancy, it is better to be left to a real design discussion with @HooglyBoogly.
So
ParticleHairCache
did hold all four possible nameschar uv_layer_names[MAX_MTFACE][MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN];
see#define MAX_LAYER_NAME_CT 4 /*
u0123456789, u, au, a0123456789. */
. Although, I am not sure if all four are required nowadays.The missing part of this patch is that the binding code should iterate over all names and bind the same texture for each of them. You can have 2 different attribute node referring to the same attribute using different name.
@ -695,3 +694,1 @@
}
else if (drw_custom_data_match_attribute(cd_point, name, &layer_index, &type)) {
domain = bke::AttrDomain::Point;
This function should either be a copy of
mesh_cd_calc_used_gpu_layers
or be unified.Return types are different (bool vs used), data values are different (DRW_MeshCDMask vs DRW_Attributes) CD_MTFACE vs CD_PROP_FLOAT2) data structure storage is different, logic is different. So would most likely be a copy and removing parts that are not needed. Unifying would change the impact in areas that are not well documented.
Would rather see this working, before restructuring the code to be more unified.
Already copying the same logic is a challenge.
@ -271,3 +272,3 @@
char sampler_name[32];
drw_curves_get_attribute_sampler_name(request.attribute_name, sampler_name);
drw_curves_get_attribute_sampler_name(
Loop over the name, don't choose one or the other.
Reviewing your comments and the code. The new take on this is to store if an attribute is a default layer. if this is the case during bind we can bind the same data to multiple samplers. This shoud replace the
input_name
with a bool 'is_default_render`. During bind the correct layer name should then be selected.I haven't seen any way how to unified code as the control flow is different.
@ -681,26 +681,111 @@ static bool ensure_attributes(const Curves &curves,
CurvesEvalFinalCache &final_cache = cache.eval_cache.final;
if (gpu_material) {
/* Next code should be kept in sync with `mesh_cd_calc_used_gpu_layers`. */
Are you refering to following code or future code? This is ambiguous.
I guess you mean
The following code
.@ -268,6 +270,10 @@ DRWShadingGroup *DRW_shgroup_curves_create_sub(Object *object,
const DRW_Attributes &attrs = curves_cache->final.attr_used;
for (int i = 0; i < attrs.num_requests; i++) {
const DRW_AttributeRequest &request = attrs.requests[i];
const int render_layer = CustomData_get_render_layer(request.domain == bke::AttrDomain::Curve ?
Look up how particle code does it, you should also support active color and such:
There is no active/default color attribute for curves, curves don't have color attributes currently.
Ok then i'm fine with the current code. But at least move
CustomData_get_render_layer
out of the loop.@blender-bot build