Hi community!
Older version called renderEngine had been move to versions folder, if you are still interested.
Renderer is a wrapper class for the maxon
and c4d
api of popular render engine for Cinema 4D.
Intended for more user-friendly manipulation of node materials with the new maxon.GraphNode model. And also with Octane Material.
Provide helper class for convenient access AOV , Material , Scene Object(Object/Tag/Light/...) in Cinema 4D popular renderer.
I try to keep it as same as possible, but each renderer has their own logic, so there are some compromises.
Happy Rendering and Scpriting!
Cheers~
DunHou
Renderer
This is a custom wrapper for most popular render engine like Octane\Redshift\Arnold\Corona\VRay in Cinema 4D, which is also contains in boghma library.
All the boghma plugins and boghma library is FREE.
Supported Renderer
- Octane
- Corona
- Node Materials with the new GraphNode model
- Redshift ( Only Node Material for Material Helper)
- Arnold ( Only Node Material for Material Helper)
- Vray ( Only Node Material for Material Helper)
Installation
- (Recommend) Download Boghma Plugin Manager and install any plugin, the boghma lib will auto installed or updated.
- Download the source code and import it to your Cinema 4D.
Quick Intro
import c4d
import maxon
from Renderer import Redshift, EasyTransaction, TextureHelper
from pprint import pprint
# Create a TextureHelper instance
# 创建一个 TextureHelper 实例
tex_helper: TextureHelper = TextureHelper()
# Get the url with given asset id
# 获取给定资产ID的URL
# "si-v1_fingerprints_02_15cm.png" with AssetId : file_fa9c42774dd05049
disp: maxon.Url = tex_helper.GetAssetUrl("file_fa9c42774dd05049")
def HowToUse():
"""
How to reate a redshift material and modify the gragh with EasyTransaction.
"""
# Create Redshift Node Material instance, if no material filled, we create a new STD material
# 创建一个Redshift节点材质实例,如果没有材质传入,创建新的STD材质
material: c4d.BaseMaterial = Redshift.Material("MyMaterial")
# Use EasyTransaction to modify the graph
# 使用EasyTransaction来修改材质
with EasyTransaction(material) as tr:
# the attribute #tr is the instance of Redshift.MaterialHelper,
# we got it with just apply to the #material to the EasyTransaction
# it will inherit from NodeGraghHelper class
# 属性tr是Redshift.MaterialHelper的实例,通过将材质赋予EasyTransaction获得,继承自NodeGraghHelper
# Use Redshift.MaterialHelper methods : add a texture + displacement to the Output node
# 使用Redshift.MaterialHelper中的方法: 添加图片+置换节点到Output节点
tr.AddDisplacementTree(filepath = disp, shadername = "DISP")
# Use NodeGraghHelper methods: get the Output(endNode)
# 使用NodeGraghHelper中的方法: 获取输出节点
output = tr.GetOutput()
print(f"{output = }")
# Insert the material to the document
# 导入材质(来自Redshift MaterialHelper)
tr.InsertMaterial()
# Auto apply GraphTransaction.Commit() to the graph
# 退出with后, 自动执行GraphTransaction.Commit()
Limit
- For some reasons, AddShader-like methods(maxon.GraphModelInterface.AddChild) will add the node in the center of the graph, if we call those methods on exsited material, it will return a mess graph, you can call Renderer.ArrangeAll() after.
- Material(except Octane) helper only support material with the new GraphNode model(Node Material after R26)
- Due to Octane use his Custom UserArea UI base on old layer system, and didn't support python, we can only modify Octane materials in material level, but can not interactive with selections in octane node editor.
- Also Octane materials didn't have a "port" or "wire" context, we can not use all those methods as same as NodeGraghHelper.
- Arnold mask tag SetPrameter has a refresh bug.
Examples
Class Presentation and Highlights
Renderer
- NodeGraghHelper
- TextureHelper
- EasyTransaction
- Redshift
- AOV
- Material
- Scene
- Octane
- AOV
- Material
- Scene
- Arnold
- AOV
- Material
- Scene
- Vray
- AOV
- Material
- Corona
- AOV
- Material
- utils
- NodeGraghHelper
- TextureHelper
- EasyTransaction
- constants