Git Product home page Git Product logo

esri / serlio Goto Github PK

View Code? Open in Web Editor NEW
15.0 6.0 4.0 7.63 MB

Serlio enables the execution of Esri CityEngine CGA rules inside of Autodesk Maya.

Home Page: https://esri.github.io/cityengine/serlio

License: Apache License 2.0

CMake 4.57% C++ 93.30% C 0.22% PowerShell 1.91%
cityengine cityengine-sdk prt maya esri autodesk serlio mel cpp 3d procedural modeling geometry architecture visualization plugin modifier

serlio's Introduction

Serlio - CityEngine Plugin for Autodesk Maya

Serlio is a plugin for Autodesk Maya. It provides a modifier node which enables the execution of CityEngine ‘rules’ within a Maya scene. Therefore, a 3D environment artist does not have to leave their familiar Maya toolset anymore to make use of CityEngine’s procedural modeling power. Complicated export-import pipelines are no longer needed, which also means that the procedural building models do not need to be “baked” in future. The buildings stay procedural during the entire modeling workflow. Consequently, the 3D environment artist can change many attributes, for example the height, style and appearance of buildings can be altered easily with a parametric interface at any point during production.

Serlio requires so-called rule packages (RPK) as input, which are authored in CityEngine. An RPK includes assets and a CGA rule file which encodes an architectural style. Comprehensive RPK examples are available below and can be used “out-of-the-box” in Serlio.

Serlio is well suited for managing the procedural generation of architectural 3D content in digital sets. However, Serlio is restricted to the procedural generation of singular objects - particularly buildings. Serlio does not include the city layouting and street network editing tools of CityEngine i.e. the rich CityEngine toolset to design a city from scratch (or based on geographic data) is still needed.

Quick Start

  1. Install Serlio by downloading the latest installer. Please see below for installation on Linux.
  2. Start Maya, a new Serlio menu item will appear.
  3. In Maya, select a mesh and use the Serlio menu to assign a rule package (RPK), for example this one which creates a simple extrusion based on a "height" parameter. You can author your own RPKs with CityEngine.
  4. Make sure the geometry is still selected and go to the serlio tab in the Attribute editor. Here you can edit the rule parameters.

Table of Contents

External documentation:

User Manual

Please refer to the release notes for the supported CityEngine version.

Installation

Software Requirements (Latest Release)

  • Windows 10 and 11 (64bit)
  • RedHat Enterprise Linux 7, 8, 9 and compatible (CentOS, Alma Linux, Rocky Linux, ...)
  • See release notes for compatible CityEngine versions and requirements for commercial work.
  • Autodesk Maya 2020, 2022 or 2023

Windows: Provided Installer

  1. Download the MSI installer for the latest release.
  2. Run the MSI installer.
  3. Start Maya.
  4. You should now see the new menu item Serlio.

Linux: Provided Binaries

  1. Acquire the Serlio binaries for the latest release.
  2. Continue with the steps linked below in the developer documentation.

Using the Serlio plugin

Add rule files

  1. Create and select a polygon mesh.
  2. Go to the Serlio menu and select "Attach CityEngine Rule Package".
  3. Select a .rpk rule file:
    1. Use this basic rule which creates a simple extrusion based on a "height" parameter
    2. Use a rule from the examples
    3. Export your own rule file from CityEngine.
  4. The selected rule will be applied to the mesh. It depends on the rule how multiple faces are handled.

Remove rule files

  1. Select the generated model(s).
  2. Go to the Serlio menu and select "Remove CityEngine Rule Package".
  3. Only the initial shape mesh with default materials remains.

Creating materials

Currently we only support one material type per mesh (see known limitations).

Viewport (Stingray) materials
  1. Select the generated model(s).
  2. Go to the Serlio menu and select "Create Materials".
  3. The materials for all selected models will be generated and displayed in the viewport.
Arnold materials
  1. Select the generated model(s).
  2. Go to the Serlio menu and select "Create Arnold Materials".
  3. The Arnold materials for all selected models will be generated.
  4. Add a light source from "Arnold" > "Lights".
  5. In order to see the rendered view either:
    • Render the current frame once: "Arnold" > "Render" or
    • Switch the renderer in the Viewport to "Arnold" and hit the start button.

Working with Attributes in the inspector

  1. Select a generated model in the Viewport or the Outliner.
  2. Go to the Serlio tab in Attribute Editor.
  3. Change the rule, seed and rule attributes in the Attribute Editor.
  4. The model will update according to the new attribute values.
  5. Use the arrow on the right of an attribute to reset the attribute to its default value. The default value might depend on the seed and/or other attributes.

Developer Manual

Software Requirements

All Platforms

  • License for CityEngine (2019.0 or later), e.g. to author Rule Packages.
  • CMake 3.13 or later (http://www.cmake.org)
  • Autodesk Maya 2020, 2022 or 2023 or the corresponding development kit

Windows

  • Windows 7, 8.1 or 10 (64bit)
  • Required C++ compiler: Visual Studio 2019 with Toolset MSVC 14.27 or later
  • WiX Toolset 3.11.1: Optional, required for building .msi installers

Linux

  • RedHat Enterprise Linux 7.x or compatible
  • Required C++ compiler: GCC 9.3 or later (RedHat Enterprise Linux DevToolSet 9.1)

Build Instructions

Windows

Building with Visual Studio
  1. Open a Visual Studio x64 Command Shell in the serlio root directory, i.e. at <your path to>\esri-cityengine-sdk\examples\serlio.
  2. Create a build directory with mkdir build and change into it with cd build.
  3. Run cmake to generate a Visual Studio solution:
    cmake -G "Visual Studio 16 2019" ../src
    
    Use options -Dprt_DIR=<ce sdk root>\cmake and -Dmaya_DIR=<maya installation root> to override the default locations of CityEngine SDK and Maya.
  4. Open the generated serlio_parent.sln in Visual Studio.
  5. Switch the solution configuration to "Release" or "RelWithDebInfo" ("Debug" is not supported).
  6. Call build on the INSTALL project.
  7. Proceed with the Installation Instructions below.
Building on the Command Line
  1. Open a Visual Studio x64 Command Shell in the serlio root directory, i.e. at <your path to>\esri-cityengine-sdk\examples\serlio.
  2. Create a build directory with mkdir build and change into it with cd build.
  3. Run cmake to generate the Makefiles:
    cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo ../src
    
    Use options -Dprt_DIR=<ce sdk root>\cmake and -Dmaya_DIR=<maya installation root> to override the default locations of CityEngine SDK and Maya.
  4. Run make to build the desired target, e.g.
    nmake install
    
  5. The build result will appear in the install directory in parallel to the build directory. We will use this as the plugin directory below.
Building MSI Installers
  1. WiX Toolset 3 (3.11.1 or later) and Apache Ant (1.10.x or later) is required for building MSI installers.
  2. Start by building Serlio with release configurations as described above.
  3. Open a Command Shell in the serlio\deploy directory.
  4. Run ant in the current directioy. Make sure to set at least one valid install path:
    ant -D"maya2023.dir"=../install
    
  5. The installer will appear in serlio\build\build_msi.

Linux

  1. Open a terminal (e.g. bash).
  2. Change into the example directory: cd <your path to>/esri-cityengine-sdk/examples/serlio
  3. Create a build directory and change into it: mkdir build && cd build
  4. Run cmake (adjust the Maya path if necessary): cmake -Dmaya_DIR=/usr/autodesk/maya2023 ../src
  5. Compile: make install
  6. The build result will appear in the install directory in parallel to the build directory. We will use this as the plugin directory below.

Install local build

Windows

  1. Locate the install directory where you built the plugin, let's call it PLUGINDIR.
  2. Locate the Maya.env file in your home, usually its in <home directory>\Documents\maya\2023.
  3. Edit Maya.env as follows:
    :: replace <PLUGINDIR> with the actual path
    PATH=<PLUGINDIR>\plug-ins;%PATH%
    MAYA_PLUG_IN_PATH=<PLUGINDIR>\plug-ins
    MAYA_SCRIPT_PATH=<PLUGINDIR>\scripts
    XBMLANGPATH=<PLUGINDIR>\icons
    
  4. Start Maya.
  5. Open the plugin manager: "Windows" -> "Settings/Preferences" > "Plug-in Manager".
  6. Enable serlio.mll.
  7. The plugin should load and a new menu item Serlio should appear in Maya.

Linux

  1. Let's call the directory with the Serlio binaries PLUGINDIR (downloaded binaries or locally built install folder).
  2. Locate the Maya.env file in your home, e.g.: ~/maya/2020/Maya.env.
  3. Edit Maya.env as follows:
    PLUGINDIR=<PLUGINDIR> # replace <PLUGINDIR> with the actual path
    MAYA_PLUG_IN_PATH=$PLUGINDIR/plug-ins
    MAYA_SCRIPT_PATH=$PLUGINDIR/scripts
    XBMLANGPATH=$PLUGINDIR/icons/%B
    
  4. Start Maya (Note: you may want to start Maya from a shell to see the Serlio log output).
  5. Open the plugin manager: "Windows" > "Settings/Preferences" > "Plug-in Manager".
  6. Enable serlio.so.
  7. The plugin should load and a new menu item Serlio should appear in Maya.

Release Notes

v2.3.0 (2024-04-02)

Required Cityengine version: 2023.1 or older. For commercial work, a license for CityEngine 2023.1 is required.

Changed:

  • Updated Procedural Runtime (PRT) to 3.1 (corresponds to CityEngine 2023.1).

v2.2.0 (2023-06-15)

Required Cityengine version: 2023.0 or older.

Added:

  • Support for Maya 2023.

Changed:

  • Updated Procedural Runtime (PRT) to 3.0 (corresponds to CityEngine 2023.0).
  • Fixed sorting of rule attributes in the Attribute Editor to get same behavior as in the CityEngine Inspector.

Removed:

  • Support for Maya 2019.

v2.1.0 (2022-07-06)

Required CityEngine version: 2022.0 or older.

Added:

  • Support for Rule Packages (RPK) created with CityEngine 2022.0

v2.0.0 (2022-06-20)

Required CityEngine version: 2021.1 or older.

Added:

  • Support for Maya 2020 and 2022. (#73)
  • Command to remove Serlio nodes and materials from mesh.
  • Support and UI for resetting user-set attributes. (#50)
  • Support for dynamic enums.
  • Support for RGB-based opacity maps. (#15, #33, #18)
  • Support for legacy usage of the @Range annotation
  • UX to display warnings and errors in rule files:
    • RPK/CGB and PRT version mismatch
    • Asset errors
    • CGA errors
    • Generate errors
  • Help tab with links to:
    • Serlio Website
    • CGA Reference
    • RPK Manual
  • About dialog with version number and license info.
  • Node Behavior and UUID tab to attributes

Changed:

  • Updated Procedural Runtime (PRT) to 2.6 (corresponds to CityEngine 2021.1) and exclude non-relevant extensions.
  • Avoid unpacking of rule package (performance improvement). (#74)
  • Improved rule attribute ordering (matching CityEngine).
  • Stopped supporting generation of rules without Maya construction history.
  • Automatically switch viewport to textured mode after generating materials.
  • Replace rule package instead of stacking Serlio nodes, when calling "Add rule package..". (#13)
  • Improved UI feedback on node for invalid rule package paths
  • Improved generation performance.
  • Fixed metadata storage on scene save/load
  • Fixed scaling of geometry.
  • Fixed random seed handling. (#51)
  • Fixed rule package reloading, when start rule changes. (#17)
  • Fixed undo/redo for material creation and rule switching.
  • Fixed crash in case PRT generates an empty mesh.
  • Fixed crash when modifying rule package path.
  • Reset material to default, when PRT generates an empty mesh.
  • Fixed enum attributes. (#23)
  • Fixed file picker. (#55)
  • Fixed error message in MEL console.
  • Fixed faintly visible transparent stingray materials.
  • Fixed Maya attribute naming issues.
  • Fixed bug that could create duplicate tweak nodes.

Development:

  • Updated compilers (now using C++ 17)
  • Updated test framework and build system
  • Bundled installers for all Maya versions (2019-2022) into one

Examples:

  • Added Street Segment example
  • Updated Favela example

v1.1.0 (2020-06-02)

  • BREAKING CHANGE: Switched to official Autodesk IDs for Serlio custom nodes. (#26)
  • Added creation of Arnold materials. (#11, #40, #65)
  • Correctly compute default values of rule attributes based on initial shape geometry.
  • Show error message if required Maya plugins (e.g. 'shaderFXPlugin') are not loaded. (#65)
  • Updated to CityEngine SDK 2019.1. (#42)
  • Introduced clang-format. (#37)

v1.0.1 (2019-08-21)

  • Merged support for creating MSI installers via CMake.
  • Fixed wrong build type of codec library in MSI installers.
  • Improved error handling when loading the plugin (check codec library).
  • Do not install unnecessary PRT codecs for Serlio.
  • Improved error handling (prevent crash) if a specified Rule Package (RPK) is not readable.

v1.0.0 (2019-07-31)

  • Optimized the encoding of PRT geometry with many meshes (e.g. results in a speedup of about 5x for the "Parthenon" CityEngine example).
  • Do not change Maya selection after user touches the attribute sliders.
  • Do not pass Maya's automatically created color child attributes to PRT.

v1.0.0-beta.1 (2019-07-26)

  • Added attribute sorting in the Maya node editor like in CityEngine.
  • Fixed saving of string rule attributes in Maya scene.
  • Fixed connectivity of generated meshes and normal orientation.
  • Fixed handling of rule attribute annotations (enum, range).
  • Fixed tex-coords handling in case some meshes do not have any.
  • Performance optimizations.
  • Rebranding to "Serlio" in UI.
  • Publication of source code on github.

v0.5.0 (2019-06-12)

  • First release after complete rewrite based on Maya "modifier node" example.
  • Better UX and conformance with behavior of other Maya geometry tools (e.g. undo).
  • Improved performance and Material support.

v0.0.0 (2012-2018)

  • Experimental Maya plugin released as source code example for CityEngine SDK.

Known Limitations

  • Serlio 2.2 and Maya 2023 on Linux: Serlio does not work if the Maya 2023 USD plugin is active at the same time (USD library clash).
  • Serlio 2.0: In Maya 2019 on Windows, Serlio does not support reading USD assets from RPKs.
  • Modifying the input shape after a Serlio node is attached is not supported.
  • Scaling transformations on the initial shape mesh will scale the entire generated model. Make sure that all scaling transformations on the initial shape mesh are frozen before applying a rule ("Modify" > "Freeze Transformations").
  • Maya uses centimeters as default working units, we recommend changing these to meters in "Windows" > "Settings/Preferences" > "Preferences" > "Settings" > "Working Units".
    • We also recommend multiplying the value of the "Near Clip Plane" and "Far Clip Plane" attributes in the perspShape of the perspective camera by a factor of 100.
  • Duplicating a generated Serlio building multiple times with copy/paste can lead to wrong materials due to a naming bug in Maya. However, there are two workarounds:
    1. Use smart duplicate instead: Go to "Edit" > "Duplicate Special" and tick "Assign unique name to children nodes".
    2. Manually rename all pasted meshes to something unique and regenerate the rule.

Licensing Information

Serlio is free for personal, educational, and non-commercial use. Commercial use requires at least one commercial license of the latest CityEngine version installed in the organization. Redistribution or web service offerings are not allowed unless expressly permitted.

Serlio is under the same license as the included CityEngine SDK. An exception is the Serlio source code (without CityEngine SDK, binaries, or object code), which is licensed under the Apache License, Version 2.0 (the “License”); you may not use this work except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0

All content in the Examples directory/section is licensed under the APACHE 2.0 license as well.

For questions or enquiries regarding licensing, please contact the Esri CityEngine team ([email protected]).

serlio's People

Contributors

afrischknecht avatar chr11115 avatar jonathan-meier avatar mama10 avatar matthias-specht avatar mistafunk avatar mlippesricom avatar sgoetschi avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

serlio's Issues

Support non-restricted enum attributes

Consider the following simple rule attribute:

@Enum("Val1", "Val2", "Val3", restricted = false)
attr enumVal = "Val1"

CityEngine provides a drop-down menu for this enumeration with entries Val1, Val2 and Val3, but also allows to set an arbitrary value not in this list.

Serlio treats both restricted and non-restricted enums as restricted.

Task:

  • Support non-restricted enum attributes, such that a user can set arbitrary values for these attributes

Note: A simple solution would be to ignore the enum annotation on non-restricted enum attributes and simply provide an input field. This way, the user would be able to set an arbitrary value, however, the enumeration options would not be visible in the UI anymore.

Properly search for downstream mesh nodes in the material nodes

Both the PRTMaterialNode and the ArnoldMaterialNode need to find mesh nodes downstream the dependency graph. Currently, this is manually implemented, only following the plug connection chain via groupParts nodes (as these auxiliary nodes are inserted, when materials are assigned on the face level).

Task:

  • Reimplement this search logic properly and with support for intermediate nodes other than groupParts nodes. MItDependencyGraph is likely to help.

File type annotation results in wrong file filter

Repro

  1. Mark an attribute as a file name.
    Example:
@File
attr test0300File = "myfile.obj"
  1. The Serlio inspector will present a file chooser.

2019-11-12_12-59-29

3. Try to select another file BUG: File Type Restriction Set to Attribute Name

2019-11-12_12-51-45

Unable to load serlio.mll in Maya 2022

Trying to manually load serlio.mll from plugin manager gives this error:
// Error: file: C:/Program Files/Autodesk/Maya2022/scripts/others/pluginWin.mel line 316: The specified module could not be found.
(serlio) //

support setting the log level via env var

  • introduce env var to set the minimally output log level
  • remove some of the compile-time guards for debug log messages (careful, some LOG_DBG can be expensive, they are always executed)

Support shininess, reflectivity and bumpValue

Currently, there's no support for the shininess, reflectivity and bumpValue material properties in either of PRTMaterialNode and ArnoldMaterialNode.

Task:

  • Add support for these three properties to the material nodes.

Arnold: adding light sources

In a newly created Maya scene, there are no light sources added by default. Therefore, we always add a physical sky light source to the scene, when we attach Arnold materials to a PRT model, since without a light source Arnold just renders black. However, if there are already existing light sources in the scene, this might not be desirable.

Task:

  • Decide on a reasonable strategy for automatically adding light sources and implement it.

Serlio fails to load at Maya startup

serlio.mll fails to load at Maya (2019) startup with error message:

// Error: Serlio: the required dependency 'shaderFXPlugin' is not loaded, please activate it! // 
// Error: line 1: initializePlugin function failed (serlio) // 
// Error: line 1: Invalid object or value: // 
// Error: line 1: Invalid object or value: // 

Manually activating the plugin works.

Arnold: material deduplication

Currently, when setting up the Arnold material shaders for a model, we don't consider already existing and matching material shader from other models and instantiate a new material shader in any case. Even worse, when changing model attributes and regenerating the model and materials, the material shaders from before the change are ignored and all material shaders are newly created.

Task:

  • Implement material shader reuse across all models and model regenerations.

Note: for the viewport material we already have deduplication

Improve matching of existing material shader to the corresponding shading group

Currently, in both PRTMaterialNode and ArnoldMaterialNode finding the shading group corresponding to a material shader is implemented by simply changing a known infix in the node name. E.g. a shader node with the name serlioGeneratedArnoldMaterialSh7 will match to the shading group with the name serlioGeneratedArnoldMaterialSg7. However, this method is unreliable, since nodes can be renamed by the user.

Task:

  • Find a more reliable way to match a shader with its shading group, e.g. by inspecting the attribute connections, since the .outColor attribute of a shader is connected to the .surfaceShader attribute of the corresponding shading group.

Make RPK extraction path configurable (ideally within Maya Project)

Currently, RPKs are extracted to the system temp directory so renderers (Arnold) can access the textures. This is a problem if generation takes a along time (temp dir might be removed at reboot) or if the project has to be relocated to another machine.

Make the RPK extraction path configurable with the default location within the currently active Maya project.

Add UI widget to control start rule

Currently, Serlio uses the rule with "@StartRule" annotation as the start rule. This is not sufficient for complex RPKs. E.g. some RPKs could contain building and street rules.

Tasks:

  1. Add a dropdown attribute below "Rule Package" in the "CGA Rules" category of the serlio editor node
  2. Populate the dropdown with all rules without parameters from the rule file (cgb) which contains the "@StartRule" annotation.
  3. If possible within Maya API, visually emphasize the rule in the dropdown which is annotated with "@StartRule"
  4. Ensure the dropdown updates correctly when switching and reloading RPKs.

Persisted material data structures are not stable and need versioning

We currently persist data structures of type adsk::Data::Structure (accessed via mesh stream channels) in the scene. These structures are created by the PRT node and consumed by the Stringray/Arnold material nodes to create the MEL scripts necessary to actually create the materials.

Why do we persist these?

  • Running Serlio on a shape with disabled construction history will only store the result (there is no Serlio node), i.e. store the material data structure is the only way to later actually create the material.

There are several issues with persisting the current material "proto" data structures:

  • These data structures are not versioned, it is not possible to do a clean legacy handling in future Serlio releases in case the structure changes.
  • The structures are dynamically derived from the generated PRT materials, i.e. a black box from Serlio pov. Changes in PRT could in-transparently lead to different material structures and crashes when Serlio tries to read it.
  • Minor: we currently convert the original wide-character string attributes to ASCII when storing in the material data structure. This will lead to problems if e.g. texture strings contain non-ascii characters. Also it requires a lot of redundant string conversions. See branch simo6772/cleanup-material-structure for preliminary work on this.

Tasks:

  1. Investigate if it is possible to avoid persisting the material data structures and therefore the need for versioning. Unfortunately, it is very likely that using Serlio with disabled construction history requires persisting the material structure nonetheless.
  2. Investigate if we actually need to support construction history turned off, i.e. is it a supported case that a Maya plugin only supports construction history turned on?
  3. Based on investigations, write implementation tickets to improve the above issues.

Arnold: UV transform: rotation support

Currently, we don't support rotation of UV coordinates in Arnold materials, since the order in which scale, translation and rotation is applied in CityEngine seems to be different than the order applied in the aiUvTransform shaders used in Arnold materials.

Task:

  • Implement support for rotation of UV coordinates.

Ideas:

  • aiUvTransform could be replace by or combined with place2dtexture
  • chain multiple aiUvTransform to enforce the order in which scale, translation and rotation is applied

Arnold: RGB opacity maps

Currently, for Arnold we only support RGBA textures as opacity maps, where the alpha channel is used as the opacity. However, CityEngine also supports RGB opacity maps, where the luminance is used as the opacity.

Task:

  • Implement support for RGB opacity maps using the luminance as opacity.

Use world space coordinates for the initial shape

In Maya, shape vertex coordinates are stored in a local coordinate system and a transform node hierarchy is used to position the shapes in the scene, thus the world space vertex coordinates of a shape are obtained by applying the transformations in the node hierarchy to the local vertex coordinates. Currently, we only use the local vertex coordinates of a shape to build the initial shape, which differs from the behavior in CityEngine, where the world space vertex coordinates are used.

Task:

  • Adapt Serlio to use world space vertex coordinates when building the initial shape.

Unique shader names

For our material shaders (both Arnold and viewport materials), we currently use a fragile approach of marking our nodes as sequential (so that their compute method doesn't get executed in parallel to other node's compute method) as well as sequentially executing MEL scripts to ensure that the shader names of our material shaders are unique. This is not necessary, since Maya itself already ensures uniqueness of node names.

Task:

  • Adapt our material nodes to rely on Maya's unique node name assignment instead of trying to ensure uniqueness ourselves.

Consistent seed handling

In CityEngine, we compute a random seed for a shape once based on its geometry. After that, the user can freely change the seed, but there is no way to reset the seed to its initial value implicitly (i.e. you have to explicitly remember the initial seed and manually set it to achieve a reset).

Essentially, the seed is an attribute that is always in override mode (as described in #50) and initialized to a random seed.

In serlio, we are not consistent, but use different seeds to compute the default attribute values and generate models. As far as I could see, the random seed for generating the models even relies on uninitialized memory (i.e. it just uses whatever value is returned from an uninitialized plug).

Task:

  • Ensure that the seeds for both default attribute computation and model generation are always the same.
  • Make the behavior of the seed consistent with CityEngine.

Arnold: Opacity map mode

Currently, in Arnold we ignore the opacity map mode (material.opacitymap.mode can be blend, mask or opaque) and simply use the default blend.

Task:

  • Implement support for the mask and opaque mode of opacity maps.

Combining texture shaders referring to the same texture

Currently, in both PRTMaterialNode and ArnoldMaterialNode we use a separate texture shaders for each map, regardless of whether the textures are actually the same or different.

Task:

  • Create only one texture shader for different maps using the same texture file.

(Do we need to support the case where a single texture file is used in multiple maps with different UV transforms?)

Add support for Maya 2020

Tasks:

  • Officially add support for Maya 2020 in the build system
  • Provide binaries for the next release

Arnold: avoid MEL script variable shadowing

When generating Arnold material for multiple models, we always reuse the same variables in the emitted MEL script, which leads to a variable shadowing warning.

Task:

  • Find a way to avoid these warnings.

Note: One possibility we might try is to encapsulate the MEL script logic in a command using C++, which as a bonus might even execute faster than the MEL script.

Support initial shapes with holes

Currently, we don't support initial shapes with holes (see screenshot below).

Task:

  • Implement support for shapes with holes, i.e. make sure that
    • the initial shape geometry is interpreted correctly (unlike in the screenshot)
    • rules relying on the geometry topology (e.g. rules using deleteHoles) produce the expected result
    • default attributes relying on the geometry topology (e.g. default attributes using the initial shape area) compute the correct value


Current state: Initial shape with a hole (left) having a simple extrusion rule applied (right).

Stingray Materials: add support for rgb-based opacity maps

followup of #15

currently, the stingray shader only supports alpha-based opacity maps. add support for rgb-based opacity maps by adding a new shader parameter which tells the shader if the opacitymap has an alpha channel or not and then switch accordingly.

Consistent default attribute handling

In CityEngine, a rule attribute can be in two states, namely in default mode or in override mode.

In default mode, the attribute always assumes the default value that is computed by the rule. The default value may change depending on the value of other attributes, the seed or the geometry.

In override mode, the user sets the attribute value explicitly, thereby overriding the default value. The attribute value always assumes the user set value, even if the default value changes when the value of other attributes, the seed or the geometry is altered.

Currently, in serlio all attributes are always treated as if they were in override mode. The attribute default values are computed once when a rule is assigned to a shape and used as the "user set" values for the override mode. A user who wishes to mimic the default mode has to manually compute and set default values if they differ from the default values computed initially. There is also no way to reset an attribute value to its current default value.

Task:

  • Implement the behavior of default and override mode for attributes in serlio according to the behavior of CityEngine described above.
  • Provide a way for the user to reset attribute values to their default in the UI.

Note:

  • Hidden boolean plugs might be a possibility to indicate the attribute modes.
  • Issue #49 is not covered by this issue and should probably be fixed first.

"Paris" example: ground floors are unexpectedly transparent

the stingray shader unexpectedly multiplies rgb-based opacity with alpha-based opacity. CityEngine falls back to rgb-based opacity if there is no alpha channel in the texture. serlio should emulate that CityEngine behavior.

reproduction: load CityEngine Paris example in Serlio

Handle instancing when building the initial shape

Instancing of a shape in Maya is lightweight shape duplication. Instead of copying the shape geometry for each duplicate, the geometry is simply appended as a child to multiple different transform nodes that position each duplicate (i.e. the shape has multiple parent transform nodes).

Once we use world space vertex coordinates to build the initial shape (Issue #35), we need to think about how we handle instanced Serlio nodes, since the initial shape geometry has multiple world space vertex coordinates (one for each parent transform).

Task:

  • Define and implement a strategy for determining the world space vertex coordinates of instanced Serlio nodes.

Attach Rule Package: Auto Connect Matching Attributes

Task
After assigning a rule package, loop over all attributes of the initial shape and connect matching attributes with the PRT node.
example:

// Connect the height attribute of the initial shape nodes with the PRT node
connectAttr polyPlane1.PRTDefault_height serlio1.PRTDefault_height;

Arnold Support

Implement material creation for Arnold, so that PRT models render out of the box (in viewport and in Arnold render view).

Open Questions:

  • investigate best approach: second PRT material node or a "switch" on the current material node?
  • should we use the same approach as for stingray, i.e. one arnold material node per PRT material OR adding a custom arnold shader/material which can read the shader properties directly from the mesh metadata (= less materials in maya, better performance)?

Enum default value is ignored

For enum attributes, the default value is always set to the first value listed in the enumeration, ignoring the actually set default.

The following rule erroneously defaults to "Val1":

@Enum("Val1", "Val2", "Val3")
attr testVal = "Val2"

Task

  • Make enum attributes default to the right default value.

Arnold: "opaque" flag on mesh nodes is not disabled for non-opqaue materials

Observed in Maya 2019 (Arnold 5.2):

  1. Create RPK with rule:
    Init --> i("/ESRI.lib/assets/Webstyles/Vegetation/Realistic/AbiesBalsamea.glb")
    
  2. Assign the RPK to a quad in a fresh maya scene
  3. Add an Arnold light
  4. (x) note how the leaf cards are not correctly cutout (no sprite rendering)
  5. Workaorund: manually disable the "Opaque" checkbox at pPlaneShape1 -> Arnold

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.