Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textures not being applied correctly, normal or uv issue? #12

Open
Astro-mh opened this issue Mar 1, 2023 · 2 comments
Open

Textures not being applied correctly, normal or uv issue? #12

Astro-mh opened this issue Mar 1, 2023 · 2 comments

Comments

@Astro-mh
Copy link

Astro-mh commented Mar 1, 2023

Hi, I've been experimenting with this on macOS (intel), and most things seem to be working nicely now. There's a few places where care needs to be taken defining UInt types when passing to the library, and volumes seem to be broken on the ProRender side, but I've otherwise been able to reproduce most of the examples.
The one issue that I now have is that texture's aren't being applied as expected, see the attached images for the same setup defined using the c++ api and one defined using the Julia version.
I've got as far as finding out that there's a mismatch between the uv values being provided by GeometryBasics.jl and the ones defined in the c++ examples. Do you have any suggestions as to where the best place would be for me to try and fix this on the Julia side?
Thanks
basic_tex_cpp
basic_tex

@SimonDanisch
Copy link
Member

What code did you run?
The Shape constructor assumes "GeometryBasics" uv format... The lower level constructors will use the one from RadeonProRender...

@Astro-mh
Copy link
Author

Astro-mh commented Mar 2, 2023

Here's essentially what my code is doing. The example above also has a uv scaling node, but removing that doesn't make a difference for this issue.

So by using Shape it's using the GeometryBasics uv format, is there a way to apply the texture using the same format, or do I need to call Shape(context, vertices, normals, faces, uvs) with my own uv definition?

Thanks.

cube = RPR.Shape(context, Rect3f(Vec3f(-1, -1, -1), Vec3f(2, 2, 2)))
push!(scene, cube)
transform!(cube, translationmatrix(Vec3f(-2, 1, 1)))

image_path = joinpath(@__DIR__, "../assets/textures/amd.png")
img = RPR.Image(context, image_path)

materialImage2 = RPR.MaterialNode(matsys, RPR.RPR_MATERIAL_NODE_IMAGE_TEXTURE)
set!(materialImage2, RPR.RPR_MATERIAL_INPUT_DATA, img)

diffuse5 = RPR.MaterialNode(matsys, RPR.RPR_MATERIAL_NODE_DIFFUSE)
set!(diffuse5, RPR.RPR_MATERIAL_INPUT_COLOR, materialImage2)

set!(cube, diffuse5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants