Comments (5)
@nkolot I am trying to implement this and make a pull request. Could you show me some ideas/pointers on how to do it?
from neural_renderer.
I actually looked into it and it is significantly hard to implement. The basic problem here is that when you renderer transparent triangles, the order in which they appear is important (the z-buffer you mentioned). I can't see a straightforward way to implement this using the current data structures. It wouldn't be hard to do it on the CPU, but on the GPU it will possibly be a nightmare. The problem here is that for each pixel you will have to store all triangles that might contribute in the rendered image, but the data structure used for that, face_index_map
can only hold one value. Ideally you would want a list for each pixel but non-regular data structures are difficult to implement in CUDA.
The other issue I was thinking about is how would you define gradients for transparent textures. Let's take for example the case where a triangle is entirely transparent. In such a scenario the renderer would simply ignore it and optimize what is "behind" this in the scene.
What are your thoughts on that?
from neural_renderer.
I also feel the same way, the current data structure is hard to change, and neither do I think it is a good idea to touch the low-level CUDA kernel files.
You right on the gradient problem. A workaround is that we make a rule that there is no perfect transparent glass in the world. In other words, we can require the user to set the alpha value at least > 0 no matter how small, therefore, part of gradients goes into the transparent layer in the proportion of alpha. If there is a glass that perfectly transparent, well, we may just remove that glass and do not make any change, we may do not need it at the first.
I had a vague idea that to implement it on high-level (for example, RasterizeFunction). The renderer generates a batch of pictures as a tensor [z, 3, W, H] rather than a single [1, 3, W, H]. Different layers of images (like Z-buffer) will finally be stitched together as one image. The alpha value serves as a mask: output = alpha * current_layer_foreground + (1-alpha) * all_previous_layers_background. There are still a lot of details, let me think for a while to concrete my idea, it is a tricky situation.
Maybe we should do #6 first.
from neural_renderer.
I am closing this issue for now because it seems very difficult to implement.
from neural_renderer.
Agree
from neural_renderer.
Related Issues (20)
- Obtaining silhouettes of multiple objects
- i get an error when i try to save obj with textures HOT 3
- ValueError: not enough values to unpack (expected 3, got 1) HOT 3
- cuda10.2 torch1.7.1 install fail
- problem about 'python setup.py install' HOT 1
- it haves some error in cuda11.4 HOT 3
- The variable of camera_up is not defined
- cannot run renderer on any other GPU other than GPU 0 HOT 1
- ImportError: /data/user/anconda3/envs/neural_test/lib/python3.7/site-packages/neural_renderer/cuda/load_textures.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIdEEPKNS_6detail12TypeMetaDataEv HOT 3
- Error in forward_face_index_map_1: invalid device function Error in forward_face_index_map_2: invalid device function Error in forward_texture_sampling: invalid device function HOT 2
- Render Silhouette For A Trimesh Object
- Render 2D Silhouette For an Input Image
- Support for macOS Apple chip HOT 1
- fails to build on Google Colab with CUDA 10.2
- RuntimeError: Error compiling objects for extension even after changing the ``AT_CHECK`` HOT 5
- The problem of python setup.py install HOT 3
- For those who are new to the installation errors HOT 4
- unknown setup problem, RTX 3090 + cuda 11.1, already convert AT_CHECK to TROCH_CHECK HOT 2
- ValueError: mode should be one of None, 'silhouettes' or 'depth' HOT 1
- pip install neural_renderer_pytorch ERROR: Could not build wheels for neural_renderer_pytorch, which is required to install pyproject.toml-based projects HOT 3
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 neural_renderer.