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

Can this library render textured models? #37

Closed
Goldname100 opened this issue Jul 20, 2019 · 5 comments
Closed

Can this library render textured models? #37

Goldname100 opened this issue Jul 20, 2019 · 5 comments

Comments

@Goldname100
Copy link

I have a .obj, .mtl, and png texture file. Is it possible to render a complete textured version of the model using this library? I wasn't too sure as I don't see any examples taking mtl files as input.

@pmh47
Copy link
Owner

pmh47 commented Jul 20, 2019 via email

@Goldname100
Copy link
Author

Can you explain what you mean by simple textured rendering? How is that different from normal textured rendering?

@pmh47
Copy link
Owner

pmh47 commented Jul 22, 2019

I meant by 'simple' that there's a single material (diffuse only), single texture, and the mesh is given directly in the code. However, there is nothing fundamentally different about rendering an obj+mtl.

@Frank-Dz
Copy link

Can you explain what you mean by simple textured rendering? How is that different from normal textured rendering?

I think sample/deferred.py provides a good demo. And I successfully made my model with texture based on this code. You can have a try.

@Frank-Dz
Copy link

@pmh47 Hi~ sorry for bothering. I want to know how to render an obj with a transparent background or specific image? I rendered some results, and all my results are like:
image

I know I should adjust the background_attributes, but I do not know how to set it.

pixels = dirt.rasterise_deferred(
        vertices=cube_vertices_clip,
        vertex_attributes=tf.concat([
            tf.ones_like(cube_vertices_object[:, :1]),  # mask
            cube_uvs,  # texture coordinates
            cube_normals_world  # normals
        ], axis=1),
        faces=cube_faces,
        background_attributes=(tf.ones([frame_height, frame_width, 6])*255),
        shader_fn=shader_fn,
        shader_additional_inputs=[texture, light_direction]
    )

Thanks for any help and guidance!

@pmh47 pmh47 closed this as completed Apr 27, 2020
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

3 participants