World coordinate texture projection

I’m starting to fiddle with MDL, in particular the checkerboard component. What I want is the checkerboard to be fixed in world space such that the pattern moves across the object as the textured object’s position changes.

I’d call this word space projection, but it seems setting world_space for placement alone doesn’t do what I need. Do i need to feed in a counter blancing offset and if so where would i get that? I’m currently working in Omniverse Material Graph but I’m happy to drop down to shader code if someone can point me at how to do that in Omniverse Code.

The 3d checker texture from the graph editor does not have a world space option.

either you modify the ::nvidia::core_definitions module or you could use the module ::base (core_definitions is mostly a simplifies view on ::base)

to modify ::nvidia::core_definitions:
-make your own copy (rename it)
you can find it on disk in composer for example (similar in code)
C:\Users<username>\AppData\Local\ov\pkg<composerdir>\kit\mdl\core\mdl\nvidia

-search for

    return base::checker_texture(
        color1: color1,
        color2: color2,
        blur: blur/4.,
        uvw: base::transform_coordinate(
            transform: rotation_translation_scale(
                scaling: object_space?scaling*state::meters_per_scene_unit() :scaling,
                translation: translation,
                rotation: math::radians(rotation)
            ),
            coordinate: object_space?
                base::coordinate_source(coordinate_system: base::texture_coordinate_object):
                base::coordinate_source(texture_space: texture_space)
        )
    );

and change base::texture_coordinate_object to base::texture_coordinate_world

-add your own module to the graph editor by
preferences->Material->Material Graph->User Allow List

Thanks! Getting access to the HLSL is super useful!

So I don’t see an ov directory in my AppData\Local

Is there a specific filename or extension I can search for to find the right directory? This is Win11 if it matters
(I found a match in D:\projects\Omniverse\Libraries\deps\b5fa2c43b3da3291ed6e3dc18d62602b\mdl\core\mdl\nvidia is this right?)

I think i got it, thanks

So, I played with this all day and have had no luck getting it to recognize my new shader. I even turned OFF the default paths to see what that did, and nothing changed.

Is there some kind of cache clear I need to do when changing the available MDL files?

Maybe a first question should have been, which Kit/create/usd_composer version are you using?

D:\projects indicates a custom install dir for OV, in that case, yes you need to translate the default install dir to your custom install. the directory you found looks correct, although you might have multiple kit installations and you need to find the right one for your create/usd composer to pick up. you will have a usd composer install and it will softlink to that kit dependency.

With recent kit versions there is a default location for user modules:

all modules in there are by default known to the application.

and adding them to the allow list makes them visible after restart

also keep an eye on the console to see any syntax errors in the file