esri / serlio Goto Github PK
View Code? Open in Web Editor NEWSerlio 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
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
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:
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.
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.
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.
Repro:
workaround: restart maya
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:
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.
define clang-format rules so they are picked up automatically by IDEs like CLion
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:
Note:
Currently, we don't support initial shapes with holes (see screenshot below).
Task:
deleteHoles
) produce the expected result
Current state: Initial shape with a hole (left) having a simple extrusion rule applied (right).
Currently, there's no support for the shininess
, reflectivity
and bumpValue
material properties in either of PRTMaterialNode
and ArnoldMaterialNode
.
Task:
Update Serlio builds to use PRT 2.1
myPlane1
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:
e.g. the "Height" attribute is missing the slider despite of having a correct "@range" annotation in the CGA rule
Update the "Favela" example with Arnold renders
... or ...
provide a new example which takes advantage of Arnold
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:
Note: for the viewport material we already have deduplication
Tasks:
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
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) //
Repro
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?
There are several issues with persisting the current material "proto" data structures:
simo6772/cleanup-material-structure
for preliminary work on this.Tasks:
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:
Observed in Maya 2019 (Arnold 5.2):
Init --> i("/ESRI.lib/assets/Webstyles/Vegetation/Realistic/AbiesBalsamea.glb")
We currently redirect logging output from PRT to the std out which appears in different places on windows and linux.
Use the MGlobal::display{info, warning, error} functions instead.
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
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;
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:
groupParts
nodes. MItDependencyGraph
is likely to help.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:
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:
Ideas:
aiUvTransform
could be replace by or combined with place2dtexture
aiUvTransform
to enforce the order in which scale, translation and rotation is appliedCurrently, 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:
(Do we need to support the case where a single texture file is used in multiple maps with different UV transforms?)
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:
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:
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.
Tasks:
PRTModifierNode
, PRTMaterialNode
and ArnoldMaterialNode
) defined by the plugin (see MTypeId
doc)Repro
@Enum( "Airplane", "Box", "Train" )
attr asset = "Train"
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:
The setup of the material structure is currently done lazily in MayaCallbacks::addMesh. This is not clean and deregistering the structure is missing as well. Refactor this.
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:
.outColor
attribute of a shader is connected to the .surfaceShader
attribute of the corresponding shading group.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:
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:
In the Stringray material node, repeat the same code cleanups and potentially share code from the Arnold material node.
If the menu item "Attach rule..." is applied on an already generated PRT model, Serlio should switch the RPK, not apply the rule on the generated model (which likely results in huge resource consumption and brings maya to standstill).
Implement material creation for Arnold, so that PRT models render out of the box (in viewport and in Arnold render view).
Open Questions:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.