taichi-dev / taichi_three

A soft renderer based on Taichi (work in progress)
https://t3.142857.red/
MIT License
223 stars 24 forks source link

`SceneRT` object has no attribute `light_dir` #14

Open chengluyu opened 4 years ago

chengluyu commented 4 years ago

Hi, when I running other's code, it keeps complaining “SceneRT object has no attribute light_dir” from this line. https://github.com/taichi-dev/taichi_three/blob/dc75a4f100f0a11c7e9c41fcc3bc98c4257566fb/taichi_three/raycast.py#L82 But the initialization of light_dir had been removed in this commit.


Here is the complete error message FYI.

[Taichi] mode=release
[Taichi] preparing sandbox at /var/folders/59/8w1k63jj0vs_rv19jwyf1nf00000gn/T/taichi-4hzhr363
[Taichi] version 0.6.29, llvm 10.0.0, commit f1bde29b, osx, python 3.8.5
[TaiGLSL] version 0.0.8
[TaiGLSL] Inputs are welcomed at https://github.com/taichi-dev/taichi_glsl
[Tai3D] version 0.0.3
[Taichi] Starting on arch=metal
[Taichi] materializing...
Traceback (most recent call last):
  File "pbf3d.py", line 337, in <module>
    scene.render()
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi_three/scene.py", line 60, in render
    self._render()
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 613, in __call__
    return self._primal(self._kernel_owner, *args, **kwargs)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 507, in __call__
    self.materialize(key=key, args=args, arg_features=arg_features)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 378, in materialize
    taichi_kernel = taichi_kernel.define(taichi_ast_generator)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 375, in taichi_ast_generator
    compiled()
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi_three/raycast.py", line 94, in _render
    color = self.color_at(coor, camera)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 42, in decorated
    return fun.__call__(*args)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 87, in __call__
    ret = self.compiled(*args)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi_three/raycast.py", line 82, in color_at
    light_dir = self.light_dir[None]
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 621, in getattr
    x = super(cls, self).__getattribute__(item)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 621, in getattr
    x = super(cls, self).__getattribute__(item)
  File "/Users/[RADACTED]/venv/lib/python3.8/site-packages/taichi/lang/kernel.py", line 621, in getattr
    x = super(cls, self).__getattribute__(item)
AttributeError: 'SceneRT' object has no attribute 'light_dir'
victoriacity commented 4 years ago

Hi,

We're currently in the process of moving to a multiple-camera/multiple-light system. Most updates in 0.0.3 were focused on rasterized rendering so raytraced scenes (SceneRT) might not be keeping up with the new API.

Since 0.0.3 is a very recent release, you can try to use the older version pip install taichi-three==0.0.2 to run the code using SceneRT.