Comments (10)
First of all, you are using mitsuba.set_variant('gpu_autodiff_spectral')
, meaning that red.reflectance.values
is not a Color3f
here but a set of values (see regular.cpp
).
Could you try again with gpu_autodiff_rgb
(and use ``red.reflectance.value` then)?
from mitsuba2.
I should work with spectral rendering. You will need to provide spectral values instead of RGB here tho.
from mitsuba2.
Thanks for reporting this!
It should now be fixed (d066893).
from mitsuba2.
Wow, thanks for the quick fix! Love the spirit!
from mitsuba2.
I'm getting a similar error when using the example at https://mitsuba2.readthedocs.io/en/latest/src/inverse_rendering/pytorch.html:
>>> import enoki as ek
>>> import mitsuba
>>> mitsuba.set_variant('gpu_autodiff_spectral')
>>>
>>> from mitsuba.core import Thread, Vector3f
>>> from mitsuba.core.xml import load_file
>>> from mitsuba.python.util import traverse
>>> from mitsuba.python.autodiff import render_torch, write_bitmap
>>> import torch
>>> import time
>>>
>>> Thread.thread().file_resolver().append('cbox')
>>> scene = load_file('../resources/data/scenes/cbox/cbox.xml')
2020-04-02 00:34:07 INFO main [xml.cpp:1129] Loading XML file "..\resources\data\scenes\cbox\cbox.xml" ..
2020-04-02 00:34:07 INFO main [xml.cpp:1130] Using variant "gpu_autodiff_spectral"
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\regular.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\path.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\independent.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\gaussian.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\hdrfilm.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\perspective.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\diffuse.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\area.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\d65.dll" ..
2020-04-02 00:34:07 INFO main [PluginManager] Loading plugin "plugins\obj.dll" ..
2020-04-02 00:34:07 INFO main [Scene] Validating and building scene in OptiX.
>>> params = traverse(scene)
>>> params.keep(['red.reflectance.value'])
>>> param_ref = params['red.reflectance.value'].torch()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\u0120819\mitsuba2\dist\python\mitsuba\python\util.py", line 41, in __getitem__
return self.get_property(*(self.properties[key]))
KeyError: 'red.reflectance.value'
>>> print(params)
ParameterMap[
]
I also haven't changed anything from the example scene cbox.xml.
I'm unsure how to fix this, but I have pulled and built the gpu_autodiff_spectral variant with the latest mitsuba2 release.
from mitsuba2.
This should be fixed now: bffd685
Thanks!
Also is should be
params.keep(['red.reflectance.values'])
as you are in spectral mode.
from mitsuba2.
@Speierers thanks! That did the job.
Also is should be
params.keep(['red.reflectance.values'])
as you are in spectral mode.
Is the above included in the documentation? I couldn't see it when following https://mitsuba2.readthedocs.io/en/latest/src/inverse_rendering/pytorch.html
A few lines down, I now have the following error:
>>> param_ref = params['red.reflectance.values'].torch()
>>> print(param_ref)
tensor([0.0400, 0.0460, 0.0480, 0.0530, 0.0490, 0.0500, 0.0530, 0.0550, 0.0570,
0.0560, 0.0590, 0.0570, 0.0610, 0.0610, 0.0600, 0.0620, 0.0620, 0.0620,
0.0610, 0.0620, 0.0600, 0.0590, 0.0570, 0.0580, 0.0580, 0.0580, 0.0560,
0.0550, 0.0560, 0.0590, 0.0570, 0.0550, 0.0590, 0.0590, 0.0580, 0.0590,
0.0610, 0.0610, 0.0630, 0.0630, 0.0670, 0.0680, 0.0720, 0.0800, 0.0900,
0.0990, 0.1240, 0.1540, 0.1920, 0.2550, 0.2870, 0.3490, 0.4020, 0.4430,
0.4870, 0.5130, 0.5580, 0.5840, 0.6200, 0.6060, 0.6090, 0.6510, 0.6120,
0.6100, 0.6500, 0.6380, 0.6270, 0.6200, 0.6300, 0.6280, 0.6420, 0.6390,
0.6570, 0.6390, 0.6350, 0.6420], device='cuda:0')
>>> image_ref = render_torch(scene, spp=8)
>>> crop_size = scene.sensors()[0].film().crop_size()
>>> write_bitmap('out.png', image_ref, crop_size)
>>> params['red.reflectance.values'] = [.9, .9, .9]
>>> params.update()
>>> params_torch = params.torch()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\u0120819\mitsuba2\dist\python\mitsuba\python\util.py", line 95, in torch
return {k: v.torch().requires_grad_() for k, v in self.items()}
File "C:\Users\u0120819\mitsuba2\dist\python\mitsuba\python\util.py", line 95, in <dictcomp>
return {k: v.torch().requires_grad_() for k, v in self.items()}
AttributeError: 'float' object has no attribute 'torch'
Thanks.
from mitsuba2.
Also I think that on this line, you might need to use an Enoki type rather than a raw list?
params['red.reflectance.values'] = [.9, .9, .9]
from mitsuba2.
Also I think that on this line, you might need to use an Enoki type rather than a raw list?
params['red.reflectance.values'] = [.9, .9, .9]
Not sure about this. This is how it is done in the tuto. I think the implicit cast can figure it out.
from mitsuba2.
Could you try again with
gpu_autodiff_rgb
(and use ``red.reflectance.value` then)?
This worked, thank you! Pretty cool. Does it not work with spectral rendering?
from mitsuba2.
Related Issues (20)
- [🔨 compilation issue] 'cmake -GNinja' step HOT 3
- [❔ other question] How to convert/extract enoki.autodiff_cuda.Float32 type array from Bitmap class? HOT 4
- [❔ other question]runtime API error = 0719 HOT 1
- [🐛 bug report] importing Pytorch after mitsuba => Segmentation fault (core dumped) HOT 1
- [❔ other question] Performance on Windows much lower than Linux? HOT 5
- [🐛 bug report] hdrfilm.cpp: duplicate channel detection HOT 3
- [❔ other question] how to uninstall mitsuba2 in linux? HOT 4
- The examples of Differentiable rendering applications HOT 2
- [🐛 bug report] OptiX "arithmetic involving uninitialized variable!" with Certain Scenes HOT 1
- [✨ feature request] Tutorial on differential rendering material acquisition HOT 1
- Something about code HOT 1
- Caught a critical exception: main [properties.cpp:401] └1∩Æ∞☺
- [✨ feature request] Does the mitsuba2 support bsdf for cloth model? HOT 1
- 用java或C++用物件導向的概念設計程式解下面的問題:讀取一組時間,計算出時針與分針的夾角,時間的格式是0:00到12:00,小時數可能為1或2位數,分鐘數總是2位數,00到59之間。輸出腳讀為0到180之間的值,角度的精確度到千分之一。例如9:00是90.000度,不是-90,也不是270,2:00則是60 HOT 1
- Rendered polarized images' intensity doesn't change according to the change of polarization angle- [❔ other question] HOT 1
- [❔ other question] setting the variant("llvm_spectral_polarized"), the code didn't work HOT 2
- [❔ other question]How can we output UV map in python? HOT 1
- - [❔ other question] I want to optimize the values in the transform component of my sensor plugin HOT 1
- Unable to compile: Windows 10: Visual Studio Community 2022 HOT 1
- White noise in spectral rendering - [❔ other question] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mitsuba2.