taichi_three icon indicating copy to clipboard operation
taichi_three copied to clipboard

Does or will Tina support Framewire or Transparent material?

Open JerryYan97 opened this issue 4 years ago • 2 comments

Hello!

I want to compare the difference between two 3D simulation (They should have subtle difference) and Framewire or Transparent materials would be two intuitive way that come to my mind to show this difference.

However, I am not able to find relevant API in Tina. Is there a way now that I can do this?

Thank you!

JerryYan97 avatar Dec 31 '20 22:12 JerryYan97

Hi! Thank for your suggestions! Tina didn't support it before. I have just pushed commit e99c1485f62a3269e7b0d9ccb9c24ff2108f1d42 to master to support rendering framewires.

However it hasn't been released to PyPI yet. So to play with it you may clone this repo and install it locally:

pip install -y taichi-tina  # uninstall the released v0.0.1 version
git clone https://github.com/taichi-dev/taichi_three.git --depth=1
cd taichi_three
python3 -m pip install wheel  # required for generating wheels
python3 setup.py bdist_wheel  # build the latest taichi-tina
python3 -m pip install dist/*.whl  # install latest taichi-tina locally on your machine

Checkout docs/wireframe.py for usage example:

# In this episode, you'll learn how to render a wireframe model in Tina
#
# This tutorial is based on docs/monkey.py, make sure you check that first

import taichi as ti
import tina

ti.init(ti.cpu)

# you may specify the line width for rendering wireframes:
scene = tina.Scene(linewidth=2)

# load the monkey using `tina.MeshModel` node (`tina.SimpleMesh` works too):
model = tina.MeshModel('assets/monkey.obj')
# convert the mesh to its wireframe using the `tina.MeshToWire` node:
wiremodel = tina.MeshToWire(model)

# add the wireframe model into scene:
scene.add_object(wiremodel)

# add the original model, with a tiny scale:
model = tina.MeshTransform(model, tina.scale(0.9))
scene.add_object(model)

gui = ti.GUI('wireframe')

while gui.running:
    scene.input(gui)
    scene.render()
    gui.set_image(scene.img)
    gui.show()

I'll try to add another commit to support transparent materials later, write to you soon!

archibate avatar Jan 01 '21 06:01 archibate

Besides, I still have question for the design of the TriangleRaster. Why don't set 'Clipping' as a default True setting? This can make it more similar to a regular rasterizer from my point of view.

JerryYan97 avatar Jan 01 '21 22:01 JerryYan97