Giter Club home page Giter Club logo

Comments (4)

DagerD avatar DagerD commented on September 25, 2024

Hi.

Thanks for report. Now this is expected behavior - materials are created exclusively for every object.

from blenderusdhydraaddon.

pablode avatar pablode commented on September 25, 2024

Why? This disallows serious work based on exported scenes.

from blenderusdhydraaddon.

bnagirniak avatar bnagirniak commented on September 25, 2024

Hello, initially we have separate USD prim with all materials. But we had significant reasons to change it to the way: object has its own material.
One of the reason is USD node tree where we have different nodes including Merge, Filter, Instancing, Root. Using separate global USD prim for materials produces problems of using such nodes.

from blenderusdhydraaddon.

pablode avatar pablode commented on September 25, 2024

Thanks for the answer, this definitely makes sense!

But I think that instancing is possible even without a root-level USD prim. I've crafted an example here:
#usda 1.0
(
    defaultPrim = "Geom"
    metersPerUnit = 1
    upAxis = "Y"
)

def Scope "Geom"
{
    def Xform "node1"
    {
        def Mesh "mesh"
        {
            def Material "someMaterial"
            {
                token outputs:surface.connect = </Geom/node1/mesh/someMaterial/node.outputs:surface>

                def Shader "node"
                {
                    uniform token info:id = "UsdPreviewSurface"
                    float3 inputs:diffuseColor = (1.0, 0.0, 0.0)
                    token outputs:surface
                }
            }

            int[] faceVertexCounts = [3, 3]
            int[] faceVertexIndices = [1, 0, 3, 1, 3, 2]
            normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)] (interpolation = "vertex")
            point3f[] points = [(0.5, -0.5, 0), (-0.5, -0.5, 0), (-0.5, 0.5, 0), (0.5, 0.5, 0)]
            uniform token subdivisionScheme = "none"

            rel material:binding:preview = </Geom/node1/mesh/someMaterial>
        }
    }

    def Xform "node2"
    {
        def Mesh "mesh"
        {
            over "someMaterial" (
                references = </Geom/node1/mesh/someMaterial>
            )
            {
            }

            int[] faceVertexCounts = [3, 3]
            int[] faceVertexIndices = [1, 0, 3, 1, 3, 2]
            normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)] (interpolation = "vertex")
            point3f[] points = [(0.5, -0.5, 1), (-0.5, -0.5, 1), (-0.5, 0.5, 1), (0.5, 0.5, 1)]
            uniform token subdivisionScheme = "none"

            rel material:binding:preview = </Geom/node2/mesh/someMaterial>
        }
    }
}

EDIT: after tinkering with this a bit more I realized that true material instancing with the instanceable metadatum, unlike the use of inheritance I outlined, does require a root level prim..

from blenderusdhydraaddon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.