Giter Club home page Giter Club logo

autodesk-forks / materialx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from academysoftwarefoundation/materialx

105.0 11.0 22.0 623.21 MB

MaterialX C++ and Python libraries

Home Page: http://www.materialx.org/

License: Apache License 2.0

CMake 0.19% C++ 5.89% Python 0.37% Objective-C 0.08% C 0.12% GLSL 0.22% JavaScript 0.37% EJS 0.01% Batchfile 0.01% CSS 0.13% Metal 0.03% Objective-C++ 0.36% Mathematica 92.23%
materialx pbr-materials lookdev real-time-rendering

materialx's People

Contributors

ashwinbhat avatar bernardkwok avatar briansharpe avatar cinifreak avatar code-monkey avatar crydalch avatar da-krunch avatar dbsmythe avatar dgovil avatar jstone-lucasfilm avatar krohmernv avatar kwokcb avatar laserallan avatar ld-kerley avatar lfl-eholthouser avatar marsupial avatar marwie avatar mjyip-lucasfilm avatar morteeza avatar nicolassavva-autodesk avatar niklasharrysson avatar pablode avatar pmolodo avatar proog128 avatar rasmusbonnedal avatar stefanhabel avatar tellusim avatar willmuto-lucasfilm avatar yurivict avatar zicher3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

materialx's Issues

Bindinputs which reference directly outputs on a nodegraph are not recognized in shader generation

If a has a which is using a "nodegraph" and "output" reference and the "output" is one of a set of outputs (multi-output), then shader generation does not appear to recognize that connection and ignores it silently.
The following is an example:

<material name="Shader">
    <shaderref name="Shader" node="standard_surface">
      <bindinput name="base_color" type="color3" output="GraphInst_base_color_output" />
      <bindinput name="specular_roughness" type="float" nodegraph="GraphInst" output="specular_roughness_output" />
    </shaderref>
  </material>
  <MtlxShader name="GraphInst" type="multioutput">
  </MtlxShader>
  <output name="GraphInst_base_color_output" type="color3" nodename="GraphInst" output="base_color_output" />
  <output name="GraphInst_specular_roughness_output" type="float" nodename="GraphInst" output="specular_roughness_output" />

The "base_color" connection is not recognized but if there is an output which references the multi-output output then it is (in the case of the "specular_roughness" mapping.

The workaround for now is to have explicit s created for each multioutput output to use for a .

Support channel qualifiers on inputs for component-component connections

This is a short proposal to be able to store direct connections between the members of a node to the members of an Input or Parameter.

1. Assumptions
As with any other feature in the specification (such as implicit output swizzling) it is not a required to support these configurations directly.

Any configuration possible here is possible to store using with one or more existing standard library nodes.

2. Specification Modifications
Add the ability to specify optional child “members” connections for an input or parameter.

The basic syntax is:

<input … [ <member name=”<name>” type=”<type>” nodename=”<nodename> [channels=”<channel>”] ] </input>

where the name attribute defines which members being written to. The contents of the name string can be interpreted the same as for the channels string. This includes the ability to perform swizzle operations.

The order of evaluation is to perform the assignment and then if present perform the input’s member assignments.

3. Examples

Example showing the “rgb” members of “in1” being assign the contents of the node “constant2”, and the “a” member being assigned the contents of the node “constant1”

<add name="add1" type="color4">
   <input name="in1" type="color4" />
     <member name="rgb" type="color3" nodename="constant2" />
     <member name="a" type="float" nodename="constant1" />
   </input>
   <input name="in2" type="color4" value="0.0, 0.0, 0.0, 0.0" />
 </add>

Example showing the “rgb” members of “in1” being assigned with the contents of “constant2” after applying the swizzle pattern “r1b”. “a” is assigned the the “x” member of constant1. The resulting value of in1 would be “0.1, 1.0, 0.7, 0.3”.

<nodegraph name="component_combine" type="">
    <constant name="constant1" type="float2">
       <parameter name="value" type="float2" value="0.3, 0.0" />
    </constant>
    <constant name="constant2" type="color3">
       <parameter name="value" type="color3" value="0.1,0.0,0.7" />
    </constant>
    <add name="add1" type="color4">
       <input name="in1" type="color4" />
         <member name="rgb" type="color3" nodename="constant2" channels="r1b" />
         <member name="a" type="float" nodename="constant1" channels=”x” />
       <input name="in2" type="color4" value="0.0, 0.0, 0.0, 0.0" />
    </add>
    <output name="out" type="color4" nodename="add1" />
 </nodegraph>

Double-sided lighting support

There appear to be issues with back-facing geometry when the shader is marked as being transparent (via a cutout so that you can see the back-facing geometry). Example snapshot:

light_culling

Seems we need to add double-sided lighting support. Can be a generation. Depending on frequency of changes can be a shader input option.

Color Array Support

Open in MURAL image
MaterialX Priority Items - Autodesk DCP

Colour arrays
The specification refers to colour arrays but they are not implemented in the library.

How Arnold works around it

We need this for the ramp shader so what we do is that we define RGB/RGBA arrays as
a float array. When we encounter it we know Arnold expects a colour so we divide the
number of values by the number of expected colour components.

Add complete set of address mode options for <image> node

Parent Issue: #389

Missing relative to GLSL and OSL was "mirror" and "default".
Both are natively supported in OSL so no code generation changes are required.
For GLSL a mapping to an address mode which is used at render time also requires no update. The actual texture bind wrap modes have been updated to provide the correct settings as well as default color ("black" now sets a black color as expected, versus using the default color which was a defect).

Sub-region Assignment

Open in MURAL image
MaterialX Priority Items - Autodesk DCP

We don’t currently support this either. We are waiting to discuss this with ILM but we may need
to drive this ourselves as it’s unlikely that they see this as a high priority. Maybe we should try to
come up with a convention that works for us and then push to include that in the standard

Generalized uv stream pre-processing

Generalize the injected pre-processing math for uv streams

  1. There is already the mx_get_target_uv() function which get's replaced with different versions depending on a global v-flip.
  2. This can be extended to actually have arguments or just modify the internal code to chose which flip to perform. In addition scale+offset can be added.
  3. The image source can be tokenized at the argument level or just inside the code. The second is easier.
  4. To have control a new ImageNode.cpp node class is required which will get the source code, replace the tokens and emit the code.

Adding "smarter" global functions can be a way to have something akin to OSL stream globals.

GenOptions on the GenContext should be immutable

Currently GenOptions on the GenContext is mutable. Since the GenContext might be reused for successive generation runs we should make this immutable to avoid side-effects from tapering with these options.

OSL vec2 clamp graph has test suite differences with GLSL

For a clamp graph like this for vec2:

    <max name="ND_max_vector2_3" type="vector2">
      <input name="in1" type="vector2" interfacename="val" />
      <input name="in2" type="vector2" interfacename="i_min" />
    </max>
    <min name="ND_min_vector2_4" type="vector2">
      <input name="in1" type="vector2" nodename="ND_max_vector2_3" />
      <input name="in2" type="vector2" interfacename="i_max" />
    </min>
    <output name="out" type="vector2" nodename="ND_min_vector2_4" />
  </nodegraph>

The nodedef is this:

    <input name="val" type="vector2" value="0, 0" uiname="Value" />
    <input name="i_min" type="vector2" value="0, 0" uiname="Min" />
    <input name="i_max" type="vector2" value="1, 1" uiname="Max" />
  </nodedef>

The OSL produced looks like this:

(
    float dummy = 0.0,
    vector2 val = {0, 0},
    vector2 i_min = {0, 0},
    vector2 i_max = {1, 1},
    output vector2 out = {0.0, 0.0}
)
{
    vector2 ND_max_vector2_3_out = max(val, i_min);
    vector2 ND_min_vector2_4_out = min(ND_max_vector2_3_out, i_max);
    out = ND_min_vector2_4_out;
}

This is the scene.xml file used:

<World>
   <Camera eye="0, 0, 4"  dir="0,0,-1"  fov="70" />

   <!-- Background clear
   0.4 0.4 0.4 : is the background color
   -->
   <ShaderGroup>
      color Cin 0.4 0.4 0.4;
      shader constant_color_background layer1;
   </ShaderGroup>

   <Background resolution="1024" />

   <!-- Shader graph for routing to output layer:
   input_shader_parameter_overrides : are parameter overrides for the input shader
   NG_algclamp_vector2_out : type of an input shader to feed into the output shader.
   out : name of output argument on input shader.
   constant_vector2: type of the output shader used to render with
   Cin : name of input argument on output shader.
   -->
   <ShaderGroup>
      
      shader NG_algclamp_vector2_out inputShader;
      shader constant_vector2 outputShader;
      connect inputShader.out outputShader.Cin;
   </ShaderGroup>
   <Sphere center="0,0,0" radius="1.0" />

</World>

which uses this util shader:


surface 
constant_vector2
    [[ string description = "Simple closure for constant color surface rendering" ]]
(
    vector2 Cin = {0.0, 0.0}
        [[  string description = "Input color to modulate emission with" ]]
)
{
    Ci = color(Cin.x, Cin.y, 0.0) * emission(); 
}

Clamp {0,0} to {0,0}->{1,1} should give you {0,0} which gets converted into {0,0,0}*emission() = 0.
Result is current green with std distribution of OSL using testrender.

Namespace Support

This placeholder is to add in namespace support for look development. This includes:

  1. Adding namespacing to existing definitions as needed.
  2. Providing namespacing support for utilities which publish new definitions.
  3. Support namespacing when managing definition libraries.

Issues:

  1. Currently there are issues with importLibrary(). If this is called then the namespace is embedded into the imported Element names and the namespace qualifier is maintained. If imported again qualifier will be applied a second time resulting in multiple of the same namespace being applied. A symptom is that nodedef/nodegraph associations may be "lost".
  • Issue was resolved as part of the 1.38 release.

No interface to reset bound images in ImageHandler

You can only delete images to unbind then. Hence once the slots are filled you cannot load any more images in. There needs to be an way to unbind after usage. e.g. unit test example image.mtlx no longer loads images properly.

Fix 3d marble mapping when using OGS XML

For some reason the matrix value bindings related to 3d marble are not stable and will change based on some state. TBD if this is an integration issue or a code generation issue,

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.