Implementation of the design task #142969. This adds the following: - Exact GPU interpolation of curves of all types. - Radius attribute support. - Cyclic curve support. - Resolution attribute support. - New Cylinder hair shape type.  What changed: - EEVEE doesn't compute random normals for strand hairs anymore. These are considered legacy now. - EEVEE now have an internal shadow bias to avoid self shadowing on hair. - Workbench Curves Strip display option is no longer flat and has better shading. - Legacy Hair particle system evaluates radius at control points before applying additional subdivision. This now matches Cycles. - Color Attribute Node without a name do not fetch the active color attribute anymore. This now matches Cycles. Notes: - This is not 100% matching the CPU implementation for interpolation (see the epsilons in the tests). - Legacy Hair Particle points is now stored in local space after interpolation. The new cylinder shape allows for more correct hair shading in workbench and better intersection in EEVEE. | | Strand | Strip | Cylinder | | ---- | --- | --- | --- | | Main |  |  | N/A | | PR |  |  |  | | | Strand | Strip | Cylinder | | ---- | --- | --- | --- | | Main |  | | N/A | | PR | ||  | Cyclic Curve, Mixed curve type, and proper radius support:  Test file for attribute lookup: [test_attribute_lookup.blend](/attachments/1d54dd06-379b-4480-a1c5-96adc1953f77) Follow Up Tasks: - Correct full tube segments orientation based on tangent and normal attributes - Correct V resolution property per object - More attribute type support (currently only color) TODO: - [x] Attribute Loading Changes - [x] Generic Attributes - [x] Length Attribute - [x] Intercept Attribute - [x] Original Coordinate Attribute - [x] Cyclic Curves - [x] Legacy Hair Particle conversion - [x] Attribute Loading - [x] Additional Subdivision - [x] Move some function to generic headers (VertBuf, OffsetIndices) - [x] Fix default UV/Color attribute assignment Pull Request: https://projects.blender.org/blender/blender/pulls/143180
92 lines
3.0 KiB
C++
92 lines
3.0 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup draw
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "draw_common_c.hh"
|
|
#include "draw_manager.hh"
|
|
#include "draw_pass.hh"
|
|
|
|
namespace blender::draw {
|
|
|
|
/** Hair. */
|
|
|
|
void hair_init();
|
|
|
|
/**
|
|
* \note Only valid after #DRW_curves_update().
|
|
*/
|
|
gpu::VertBuf *hair_pos_buffer_get(Scene *scene,
|
|
Object *object,
|
|
ParticleSystem *psys,
|
|
ModifierData *md);
|
|
|
|
gpu::Batch *hair_sub_pass_setup(PassMain::Sub &sub_ps,
|
|
const Scene *scene,
|
|
const ObjectRef &ob_ref,
|
|
ParticleSystem *psys,
|
|
ModifierData *md,
|
|
GPUMaterial *gpu_material = nullptr);
|
|
|
|
gpu::Batch *hair_sub_pass_setup(PassSimple::Sub &sub_ps,
|
|
const Scene *scene,
|
|
const ObjectRef &ob_ref,
|
|
ParticleSystem *psys,
|
|
ModifierData *md,
|
|
GPUMaterial *gpu_material = nullptr);
|
|
|
|
/** Curves. */
|
|
|
|
/**
|
|
* \note Content of the vertex buf is only valid after #DRW_curves_update().
|
|
*/
|
|
gpu::VertBuf *curves_pos_buffer_get(Object *object);
|
|
|
|
gpu::Batch *curves_sub_pass_setup(PassMain::Sub &ps,
|
|
const Scene *scene,
|
|
Object *ob,
|
|
GPUMaterial *gpu_material = nullptr);
|
|
|
|
gpu::Batch *curves_sub_pass_setup(PassSimple::Sub &ps,
|
|
const Scene *scene,
|
|
Object *ob,
|
|
GPUMaterial *gpu_material = nullptr);
|
|
|
|
/* Point cloud. */
|
|
|
|
gpu::Batch *pointcloud_sub_pass_setup(PassMain::Sub &sub_ps,
|
|
Object *object,
|
|
GPUMaterial *gpu_material = nullptr);
|
|
|
|
gpu::Batch *pointcloud_sub_pass_setup(PassSimple::Sub &sub_ps,
|
|
Object *object,
|
|
GPUMaterial *gpu_material = nullptr);
|
|
|
|
/** Volume. */
|
|
|
|
/**
|
|
* Add attribute bindings of volume grids to an existing pass.
|
|
* No draw call is added so the caller can decide how to use the data.
|
|
* \return nullptr if there is nothing to draw.
|
|
*/
|
|
PassMain::Sub *volume_sub_pass(PassMain::Sub &ps,
|
|
Scene *scene,
|
|
Object *ob,
|
|
GPUMaterial *gpu_material);
|
|
/**
|
|
* Add attribute bindings of volume grids to an existing pass.
|
|
* No draw call is added so the caller can decide how to use the data.
|
|
* \return nullptr if there is nothing to draw.
|
|
*/
|
|
PassSimple::Sub *volume_sub_pass(PassSimple::Sub &ps,
|
|
Scene *scene,
|
|
Object *ob,
|
|
GPUMaterial *gpu_material);
|
|
|
|
} // namespace blender::draw
|