ospray / hdospray

Rendering plugin for Pixar's USD Hydra
Apache License 2.0
119 stars 15 forks source link

Q: Describing Ptex texturing? #3

Closed rhaleblian closed 4 years ago

rhaleblian commented 4 years ago

Hi guys, finally i got back to getting this working on our site's RHEL systems. It's nice. A number of the ARKit objects texture properly. Have you got an example of a model using Ptex? I don't see an analogous prim to UsdUVTexture... There's HwPtexTexture_1 but i'm not sure this is meant to work anymore. I'm using 0.2.x and am trying to get a 0.3.0 build. Cheers

rhaleblian commented 4 years ago

Update: just got an 0.3.0 build working:

BruceCherniak commented 4 years ago

Hi Ray,

Cool! Glad you got 0.3.0 to build. The only Ptex model we've been working with is a port of the Moana Island scene to USD. Not aware of other USD Ptex scenes, but would love examples.

Cheers!

rhaleblian commented 4 years ago

It's funny, i'm using that dataset too! Let's compare notes. When i get this working we can make more examples. What i have now (isMountainA's groundplane mesh mountain_geo) is using HwPtexTexture_1 which successfully maps in usdview GL. My goal is to get mapping in usdview OSPRay, but i can only get what appears to be a color output of (1,1,1) into the UsdPreviewSurface in question.

    def "texture"
    {
        def Material "mountain_geo"
        {
            token outputs:surface.connect = </isMountainA/texture/mountain_geo/surface.outputs:surface>

            def Shader "surface"
            {
                uniform token info:id = "UsdPreviewSurface"
                float inputs:clearcoat = 0
                float inputs:clearcoatRoughness = 0.01
                color3f inputs:diffuseColor = (0.5, 0.5, 0.5)
                color3f inputs:diffuseColor.connect = </isMountainA/texture/mountain_geo/color_map.outputs:rgb>
                float inputs:displacement = 0
                color3f inputs:emissiveColor = (0, 0, 0)
                float inputs:ior = 1.5
                float inputs:metallic = 0
                float3 inputs:normal = (0, 0, 1)
                float inputs:occlusion = 1
                float inputs:opacity = 1
                float inputs:roughness = 0.5
                color3f inputs:specularColor = (1, 1, 1)
                int inputs:useSpecularWorkflow = 0
                token outputs:surface
            }

            def Shader "color_map"
            {
                uniform token info:id = "HwPtexTexture_1"
                asset info:filename = @./mountain_geo.ptx@
                color3f outputs:rgb
            }
        }
    }

(this layer has a model too, which i've elided here.)

Does your description look something like that?

carsonbrownlee commented 4 years ago

Great to hear from you again! Our version is likely much older. If you could send us a newer version it would probably make helping you a lot smoother:) IsMountainA does not have a a texture folder. It's only material specification appears to be " over "ptex" { uniform asset inputs:filename = @./xgenInstances/archive/color.ptx@ } "

carsonbrownlee commented 4 years ago

In the defaultMaterial.usda it references, the one difference I see to how you are specifying the ptex filename is that ours uses: "asset inputs:filename = @...@" instead of info.

rhaleblian commented 4 years ago

Those are great leads. I'm going to package and ship our isMountainA to you next week.

On the theory that my OSPRay build may not be totally kosher: When opening the ARKit tulip in usdview, i get messages eg

unhandled texToken: occlusion
unhandled token: default 
OSPRAY ERROR [1]: Could not find geometry of type: trianglemesh.  Make sure you have the correct OSPRay libraries linked.

which i would like to chase down.

rhaleblian commented 4 years ago

[non-sequitur] Because pictures are fun: Apple Tulip and OSPRay. image

rhaleblian commented 4 years ago

ps. if your isMountainA works, ship it to me!

rhaleblian commented 4 years ago

I have posed the general question to usd-interest on Google Groups. USD source suggests that HwPtexTexture_1 is still a thing, but then again there is also code that handles deprecated shading constructs. The message OSPRAY ERROR [1]: Could not find geometry of type: trianglemesh. Make sure you have the correct OSPRay libraries linked. may only be happening when switching from GL to OSPRay in GUI, so i don't care so much about it.

rhaleblian commented 4 years ago

The afore cited OSPRAY ERROR [1]: Could not find geometry of type: trianglemesh. Make sure you have the correct OSPRay libraries linked. looks to have been a build problem on my end.

BruceCherniak commented 4 years ago

Sorry, been on Thanksgiving vacation. I’ll try to get you the isMountainA tomorrow, although I’ve found isKava easier to work with, so I’ll probably send you that as well.

Glad you resolved whatever build issue this was.

On Dec 1, 2019, at 5:03 PM, Ray Haleblian notifications@github.com<mailto:notifications@github.com> wrote:

The afore cited OSPRAY ERROR [1]: Could not find geometry of type: trianglemesh. Make sure you have the correct OSPRay libraries linked. looks to have been a build problem on my end.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/ospray/hdospray/issues/3?email_source=notifications&email_token=ACPU2VFAZXY4BA7VXW27MKTQWQ7CPA5CNFSM4JPJ66DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFRYRPY#issuecomment-560171199, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACPU2VH2OTC7ALTJ3R2QLSDQWQ7CPANCNFSM4JPJ66DA.

carsonbrownlee commented 4 years ago

hi Bruce, sorry for not updating this issue. Ray and I were exchanging emails trying to figure out how to securely send the data over. Rather than discussing that on github, I'll cc you on the thread.

carsonbrownlee commented 4 years ago

I saw the discussion on usd-interest. A bit worrisome that this is so ill defined, I don't believe I've seen an example yet that specifies the "isPtex" flag. To support backwards compatibility, I may check that flag and the file extension.

rhaleblian commented 4 years ago

After disambiguating two versions of Ptex libraries in my build (ie avoiding building against or loading the wrong one), i can get a texture on isMountainA ground plane consistently.

image

rhaleblian commented 4 years ago

ps. I'll be going through isKava and others, which should reinforce our understanding of the behaviour.

rhaleblian commented 4 years ago

pps. @carsonbrownlee Prman exposes a Shader prim for Ptex that our site has used successfully; it could be used as a precedent for OSPRay. I can dig it up at some point.

carsonbrownlee commented 4 years ago

@rhaleblian that would be great, we really lack data to test against. I have filed an issue in our internal gitlab for grabbing the filename from info: instead of inputs:.

rhaleblian commented 4 years ago

ps. we also could rework the additional small examples on http://ptex.us, eg. the teapot, to USD. that and the others would be suitable CI test data etc.

carsonbrownlee commented 4 years ago

@rhaleblian any updates on the prman ptex shader prim? I'll dig around for it, good excuse to play around with prman.

carsonbrownlee commented 4 years ago

digging around for ptex shader prim in renderman plugin code turned up empty for me. I can confirm that HdStorm code checks file extension now for determining ptex textures.