Open robinroy03 opened 4 months ago
Hello @robinroy03, Thank you for updating!
Cheers! There are no style issues detected in this Pull Request. :beers: To test for issues locally, pip install flake8
and then run flake8 fury
.
Hi @robinroy03,
Thank you for this, I will try tomorrow and give you an update
during this time, can you fix all the pep8 issues?
@skoudoro I've fixed all the pep8 issues and have placed some of my thoughts in the code as comments. (and also in the PR description) I'll add tests and finish this once you're ok with them.
Hi @skoudoro,
Are there any inbuilt VTK functions that do this? (mapping different textures to different sides of a cube) Because when I searched I found this (https://discourse.vtk.org/t/how-to-apply-different-textures-to-each-face-of-a-tetrahedron/2333/2), and I'm not sure if I should go this path directly.
Are there any resources for UV-Mapping textures in VTK? (I referred both VTKUsersGuide and VTKTextbook, found no examples)
I found this fury/io/load_cubemap_texture
function and used it. But I am unable to map the cubemap to the cube. (the below code does not work).
import vtk
from fury import actor, window
from fury.io import load_cubemap_texture
tx = load_cubemap_texture(fnames = [
"negx.jpg",
"negy.jpg",
"negz.jpg",
"posx.jpg",
"posy.jpg",
"posz.jpg"
])
scene = window.Scene()
cubeSource = vtk.vtkCubeSource()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(cubeSource.GetOutputPort())
cube_actor = vtk.vtkActor()
cube_actor.SetTexture(tx)
cube_actor.SetMapper(mapper)
scene.add(cube_actor)
window.show(scene)
Can I get some help regarding the general direction?
Or should I take 6 PlaneSources and merge them?
@skoudoro,
Please check the new commit, I've used 6 planes to make the cube. I can use vtkAssembly()
to make them 1 single actor if needed.
Use a cubemap texture from here to test.
If this is ok, I'll finish this code with some more methods such as texture_update
, get_actor
etc ... (or should I format the code differently? I believe this class should go inside actor.py)
Demo Video:
https://github.com/fury-gl/fury/assets/115863770/75f43bd2-c81b-4b60-8f53-c21ef9ae1b5b
This code is not rendering a video, but it'll be done in texture_update
. I just wanted to know whether my general direction is correct & feedback about how I'm organizing the code.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 84.46%. Comparing base (
14851c6
) to head (b26842a
).
@skoudoro I've finished everything. Please take a look and let me know if I've to make modifications.
I've made the changes. For test_actors
, I only did a test for 1 side colour render. I avoided remaining because it all comes from the same pipeline, so must be similar.
@skoudoro, I'm sorry but how do I render it locally? Every time I try I get a segf (it's an open issue #481).
I did create docs (by adding the disable examples flag
), but my new code is not shown there. What is the procedure to add my code to the docs?
What is the procedure to add my code to the docs?
you need to add it in docs/examples/_valid_examples.toml
Every time I try I get a segf
for now, run it multiple times consecutively
All the said modifications are done. I also committed the new file _valid_examples.toml
.
I think this is a bug, but viz_play_cube.png
will be all black unless I turn interactive = True
. It takes a screenshot immediately, even before the actors are rendered. But if we give it some time after turning interactivity on, it works fine (since the actors are rendered).
I also noticed these issues with window.snapshot
where they take screenshots very immediately even before some actors are rendered.
Hi @skoudoro, PTAL.
Thank you.
@skoudoro,
All the requested changes are made. Should I modify the function to be placed inside the tutorial? We'd discussed using 6 different actors to render the cube multiple times.
All the requested changes are made.
Thanks!
Should I modify the function to be placed inside the tutorial?
I do not know yet
We'd discussed using 6 different actors to render the cube multiple times.
I know... the fact that we talk about it multiple time show that I am not completely satisfy with this solution because I can see long term issue with it. I have hard time to block time to dig in the texture actor to see if there are alternatives or something that we are missing.
ok, I'll also keep researching whether there are better ways to do this.
Render a video on a cube (#322)
This PR adds a new actor -
texture_on_cube
tofury/actor.py
which takes 6 different texture arguments for the different sides of a cube. It also adds the tutorial and tests for the same.How it is done
I took 6 planes and merged them to form a cube.
How is video rendered
Video is rendered by changing the texture repeatedly.
Simple static texture demo:
https://github.com/fury-gl/fury/assets/115863770/2dd11e67-38f2-4fcd-84a9-a2af09aa1b81