Skip to content

Document binding a RDUniform to a particular mipmap level #9619

Open
@blackears

Description

@blackears

Describe the project you are working on

A volumetric data viewer that uses compute shaders.

Describe the problem or limitation you are having in your project

Godot currently does not have a way to bind a specific mipmap level to a shader input slot. This is necessary to let you target a particular mipmap with reading or writing. I need to be able to do this because I've developed a shader that calculates a gradient from a source image, and I need to run through every mipmap level in my texture and apply it to each level (so I can create an output texture that is the gradient of my input texture at all mipmap levels). At the moment I'm only able to use it on the base level map.

The OpenGL standard provides a way to do this with methods like:
void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);

I'm not sure what the best way would be to add this to Godot, but adding an extra field to RDUniform to specify the mipmap level seems like the most logical place for me.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

If I could specify a mipmap level, I could compute the mipmaps of my target texture by just running my computer shadere on each mipmap level. At the moment it looks like I need to do a work around by dumping the texture to the CPU so I can do each mipmap level individually.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Add an extra field to RDUniform that specifies a mipmap level to be bound to glsl image2D and image3D slots.

If this enhancement will not be used often, can it be worked around with a few lines of script?

The work around involves dumping image data to the CPU which is very slow.

Is there a reason why this should be core and not an add-on in the asset library?

Requires changing how RenderingServer works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:class referenceIssues and PRs about the class reference, which should be addressed on the Godot engine repositoryenhancementtopic:rendering

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions