Hydra: add support for legacy hair particles #114197

Merged
Brecht Van Lommel merged 27 commits from DagerD/blender:hydra-add-legacy-hair-particles into main 2024-01-11 15:44:35 +01:00

Purpose

Add support for legacy hair particles

Technical steps

Added class HairData

Ref #110765

### Purpose Add support for legacy hair particles ### Technical steps Added class `HairData` Ref https://projects.blender.org/blender/blender/issues/110765
Georgiy Markelov added 13 commits 2023-10-27 16:27:48 +02:00
Georgiy Markelov requested review from Brian Savery (AMD) 2023-10-27 16:29:38 +02:00
Georgiy Markelov requested review from Vasyl Pidhirskyi 2023-10-27 16:29:39 +02:00
Bogdan Nagirniak requested changes 2023-10-27 17:17:29 +02:00
Bogdan Nagirniak left a comment
Contributor

Code improvements are required

Code improvements are required
@ -36,3 +37,3 @@
void insert() override;
void remove() override;
void update() override;
virtual void update() override;
Contributor

this is already virtual

this is already virtual
DagerD marked this conversation as resolved
@ -254,6 +257,12 @@ pxr::SdfPath HydraSceneDelegate::material_prim_id(const Material *mat) const
return prim_id((ID *)mat, "M");
}
pxr::SdfPath HydraSceneDelegate::hair_prim_id(const pxr::SdfPath parent_obj,
Contributor

consider name psys_prim_id, change pxr::SdfPath parent_obj to Object *obj

consider name `psys_prim_id`, change `pxr::SdfPath parent_obj` to `Object *obj`
DagerD marked this conversation as resolved
@ -257,0 +260,4 @@
pxr::SdfPath HydraSceneDelegate::hair_prim_id(const pxr::SdfPath parent_obj,
const ParticleSystem *psys) const
{
return parent_obj.AppendPath(pxr::SdfPath(prim_id((ID *)psys, "H").GetName()));
Contributor

Consider id as: <O_...>_<PS_...>

Consider id as: `<O_...>_<PS_...>`
DagerD marked this conversation as resolved
@ -520,6 +517,49 @@ void HydraSceneDelegate::update_collection()
});
}
void HydraSceneDelegate::update_object(Set<std::string> &available_objects, Object *object)
Contributor

move this function as internal to update_collection()
auto update_object = [&available_objects](Object *object) {...};

move this function as internal to update_collection() `auto update_object = [&available_objects](Object *object) {...};`
DagerD marked this conversation as resolved
@ -523,0 +524,4 @@
continue;
}
if (HairData::is_supported(psys) && HairData::is_visible(this, object, psys)) {
pxr::SdfPath psys_path = hair_prim_id(object_prim_id(object), psys);
Contributor

psys_path -> id

psys_path -> id
DagerD marked this conversation as resolved
@ -523,0 +525,4 @@
}
if (HairData::is_supported(psys) && HairData::is_visible(this, object, psys)) {
pxr::SdfPath psys_path = hair_prim_id(object_prim_id(object), psys);
ObjectData *psys_data = object_data(psys_path);
Contributor

`HairData *h_data = hair_data(psys_path);

`HairData *h_data = hair_data(psys_path);
DagerD marked this conversation as resolved
Georgiy Markelov added 1 commit 2023-10-27 18:23:11 +02:00
Georgiy Markelov added 1 commit 2023-10-27 18:26:06 +02:00
Bogdan Nagirniak requested changes 2023-10-27 19:44:16 +02:00
@ -182,0 +194,4 @@
bool HairData::is_supported(const ParticleSystem *particle_system)
{
if (particle_system->part && particle_system->part->type == PART_HAIR) {
Contributor

simplify to return particle_system->part && particle_system->part->type == PART_HAIR

simplify to `return particle_system->part && particle_system->part->type == PART_HAIR`
DagerD marked this conversation as resolved
@ -182,0 +213,4 @@
ID_LOGN(1, "");
if (psys_in_edit_mode(scene_delegate_->depsgraph, particle_system_)) {
return;
Contributor

This doesn't suit to scene delegate design, there shouldn't be uninited objects. This check has to be made before calling init()

This doesn't suit to scene delegate design, there shouldn't be uninited objects. This check has to be made before calling init()
DagerD marked this conversation as resolved
@ -182,0 +227,4 @@
if (particle_system_->part->type != PART_HAIR) {
CLOG_WARN(LOG_HYDRA_SCENE, "Unsupported particle type: %d", particle_system_->part->type);
if (scene_delegate_->GetRenderIndex().HasRprim(prim_id)) {
remove();
Contributor

This shouldn't be there. It should be on scene delegate side

This shouldn't be there. It should be on scene delegate side
DagerD marked this conversation as resolved
@ -94,6 +94,7 @@ class HydraSceneDelegate : public pxr::HdSceneDelegate {
pxr::SdfPath prim_id(const ID *id, const char *prefix) const;
pxr::SdfPath object_prim_id(const Object *object) const;
pxr::SdfPath material_prim_id(const Material *mat) const;
pxr::SdfPath psys_prim_id(Object *parent_obj, const ParticleSystem *mat) const;
Contributor

Seems hair_prim_id suits better here

Seems hair_prim_id suits better here
DagerD marked this conversation as resolved
Georgiy Markelov added 1 commit 2023-10-30 08:31:56 +01:00
Bogdan Nagirniak added 2 commits 2023-11-01 03:03:30 +01:00
Bogdan Nagirniak approved these changes 2023-11-01 03:05:02 +01:00
Georgiy Markelov requested review from Brecht Van Lommel 2023-11-01 12:44:52 +01:00
Vasyl Pidhirskyi requested changes 2023-11-01 15:48:45 +01:00
Vasyl Pidhirskyi left a comment
Member

Please check UVs, looks like current result is incorrect.

Please check UVs, looks like current result is incorrect.
Bogdan Nagirniak reviewed 2023-11-02 12:29:59 +01:00
Bogdan Nagirniak left a comment
Contributor

Agree about UVs

Agree about UVs
Georgiy Markelov added 1 commit 2023-11-03 14:03:55 +01:00
Bogdan Nagirniak added 2 commits 2023-11-05 18:19:45 +01:00
Bogdan Nagirniak approved these changes 2023-11-05 18:20:14 +01:00
Bogdan Nagirniak left a comment
Contributor

Tested - works good

Tested - works good
Vasyl Pidhirskyi approved these changes 2023-11-06 14:32:47 +01:00
Vasyl Pidhirskyi left a comment
Member

Works as intended.

Works as intended.
Bogdan Nagirniak added 2 commits 2023-11-20 09:41:26 +01:00
Contributor

@brecht please review

@brecht please review

@blender-bot build

@blender-bot build
Brecht Van Lommel added 2 commits 2024-01-10 20:57:47 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
33e7a70953
Merge branch 'main' into HEAD
Brecht Van Lommel approved these changes 2024-01-10 20:58:00 +01:00

@blender-bot build

@blender-bot build
Reminder to solve, some warnings to fix before merging: https://builder.blender.org/admin/#/builders/132/builds/3296 https://builder.blender.org/admin/#/builders/134/builds/3353 https://builder.blender.org/admin/#/builders/133/builds/3155
Brecht Van Lommel added 1 commit 2024-01-11 14:34:35 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
fdc2e8355c
Cleanup: compiler warnings

@blender-bot build

@blender-bot build

@blender-bot build

@blender-bot build
Brecht Van Lommel added 1 commit 2024-01-11 15:15:46 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
25a9d2392c
Cleanup: compiler warnings
Brecht Van Lommel merged commit 9a7ea993d0 into main 2024-01-11 15:44:35 +01:00
Brecht Van Lommel deleted branch hydra-add-legacy-hair-particles 2024-01-11 15:44:37 +01:00
Sign in to join this conversation.
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
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#114197
No description provided.