Jump to content

How to bypass the UV render Raytracing restriction ?


Recommended Posts

Hi guys !

 

I would like to know if some houdini wizard can solve this one.

 

- I would like to be able to bake GI compute in PBR mode into a UV texture.

- mantra offer the possibility to bake the result into a UV texture in Micropolygon and PBR Micropolygon

- When using raytracing / PBR it doesn't work and give an error message "Raytracing not supported".

- actually i need this feature because i have to export GI lightmap to a real time engine.

 

I am in the configuration where i will probably have to

- learn how to use V-Ray

- Buy a V-Ray license that i will only use for this

 

just because this feature is not supported , so before spending my precious money , i would like to be 100% sure that

there are no workaround !

 

Thanks for your help !

 

Cheers

 

E

Edited by sebkaine
Link to comment
Share on other sites

Yes Marty that could also be an option. 3delight/prman also include a bake2D option , but sticking to Mantra would have been cool.

And if i go with 3Delight and need more power, license are more expensive than prman now. So better go with prman 19 imo.

 

Vray / Prman in both case i have to put a new renderer in the loop.

Edited by sebkaine
Link to comment
Share on other sites

Thanks for your answer guys !

 

I have prepare a small scene as an exemple. You just have to replace $PROJECT in scene var.

https://www.dropbox.com/s/vh0jx0bgaozbews/BAKE.rar?dl=0

 

@Jason

Well i am not sure it works Properly, but it doesn't give me an error message during the baking process.

It looks that it's Raytracing / PBR mode that are not supported.

 

But after playing with this , i find that houdini is not on par with maya when playing with real-time stuff.

- for exemple the mantra material emission channel doesn't work in Open GL it looks it's not connected

- the OGL part of the mantra material is pretty awkward  you just can plug Diffuse / Spec and that's all, not VOP level of control

- the outpout produce in Micropolygon is not that good compare to V-Ray for exemple

- the baking process is camera dependant and if my memory is correct prman do the same thing all face not seen by camera are Black

 

Well i would be glad to have your advise on the best engine on earth that support :

- PBR animation rendering

- PBR Lightmap generation

 

The engine than can bake are to my knowledge:

- Mantra

- Prman

- 3Delight

- Mental Ray

- Turtle

- V-Ray

- UE4 lightmass tool

 

And i thinks that's about it . and from what i have seen it looks that

- Vray

- Unreal Engine 4

Are the most powerfull ,

 

but i would be glad to get any feedback on this

I just need the best Lightmap builder of the market for exporting to a real time engine

 

Thanks again for your help !

Edited by sebkaine
Link to comment
Share on other sites

Thanks for your input Arthur ! i think Mantra will not be good enough for the quality i expect.

 

After googling a little it looks that there are nearly no alternative to V-Ray quality for Baking GI to Lightmap.

So i guess the cost of a V-Ray license is worth the quality it give in this area.

 

Blender guys on blender forum look also to praise V-Ray baking quality.

I'm quite sure Mantra / Prman / 3Delight are all View dependant , face not facing camera are black.

 

Only V-Ray and Mental Ray Bake all info , and only v-ray looks to do it with top quality.

 

some random links

http://blenderartists.org/forum/showthread.php?302197-Lightmaps!-Vray-BI-and-now-Cycles!/page2

https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/Lightmass/index.html

https://developer.valvesoftware.com/wiki/Advanced_Lighting

Link to comment
Share on other sites

It'd be cool to post your bakes from V-ray when you can. We can then see what tricks that can be done in Mantra and/or pass it onto SESI to improve Mantra.

 

Thanks!

Link to comment
Share on other sites

No problem marty ! but the feature v-ray have that i need

- baking is not camera dependant , face hidden also get illumination bake in the texture

- baking is support with any V-ray features GI / sss / caustics ...

- you have a bleeding option that allow you to stretch edge color to avoid seam error

- very accurate bake no artefact or aliasing patterns

 

But i think compare to mental ray it lack the following key features

- bake color to vertex directly

 

So if mantra could support bake that has all those option this would make it the killing tools to export lightmap to game.

And whatever people say about lightmap that are not convenient , big game and UE4 for ex still use them a lot :)

 

But again i really think houdini workflow for game real time display in viewport is not as good as maya.

The Open GL stuff in mantra shader has very limited feature and it's a lock box.

I guess few people will hard code their custom shader just to display a map in emission mode.

 

Real time is coming faster than ever i hope sesi will bring us cool stuff on this side !

  • Like 1
Link to comment
Share on other sites

Ok, I tried this before and failed, but this time I kinda got it. Quite hacky, but here we go.

  • First, render out an uv-unwrap of P and N using micropolygon mode.
  • Second, and this is optional, dilate P and N in COPs.
  • Thirdly, bake with PBR, using a lens shader that picks up the P and N from the above map, and shoots each ray back at the surface from 1mm height or something.

post-2678-0-92003300-1426524285_thumb.jp

 

Being Houdini, this can of course be trivially automated. It's not perfect and can need a bit of tinkering, but in a pinch it could be usable   :)

 

 

I have used the lens shader method before with mesh/nurbs primitives to bake some effect things, but by itself the method can only work with geometry that is a single primitive. This time I first thought I'd bake out a map with primitive IDs which the lens shader could read, but soon realized it would be a lot smarter to just bake out the P and N. It took a while to get the map dilation to work - I had all sorts of weird stuff happening before I realized the COPs dilate doesn't like negative numbers..

 

post-2678-0-64010500-1426524282_thumb.jp

ee_uvlens_bedroom.hip

post-2678-0-68675800-1426524786_thumb.jp

  • Like 3
Link to comment
Share on other sites

Whaou ! this looks great eetu ... definitly a geeky flavor on this one. I will need some time to digest your hip.

and i' ll try to see if it's cool enough compare to V-Ray.

 

I was playing with V-Ray today, and the Vertex Bake of V-ray and mantra are playing very nicely together,

here is a screenshot :

 

bake.png

 

Basically all the lighting / shading info is bake into vertex by V-Ray, i am just reading the Cd color channel in houdini and display it in constant shader.

So baking GI in vertex geo and reading it and render in Mantra is a cool idea to get blazing fast render or real time display

 

 

thanks a lot for taking the time to find a working solution to the problem !

Edited by sebkaine
Link to comment
Share on other sites

Well it works smoothly ! But i have a problem to get the exact same image as the render.

i have the following scene that use your tricks you just have to update $PROJECT to make it work:

https://www.dropbox.com/s/v8lj89efj8zays4/bake_pbr.rar?dl=0

 

but if you look at the attach image i can't reproduce the exact same outpout.

In fact specular reflection doesn't match.

 

at first i thought that it was cause by the angle of view of the bake camera that was place in

the center of the world in your scene.

 

but i try to orient all the camera in the exact same position but i keep getting the same problem.

do you think it would be possible to solve this eetu ?

 

i'm quite sure if there is a fix it could be in your lens shader where the magic happen.

but to be honest i don't understand precisely how it works ! :)

 

but i think the bake PBR diffuse is working. Don't ask me why i want to bake specular ... i know it looks stupid ! :)

post-6698-0-77949100-1426602739_thumb.jp

Edited by sebkaine
Link to comment
Share on other sites

but if you look at the attach image i can't reproduce the exact same outpout.

In fact specular reflection doesn't match.

 

do you think it would be possible to solve this eetu ?

 

Cool that you got it to work for you in the first place!

 

Baking the reflection/specular with this technique has an inherent problem. For each lightmap texel the "camera" ray is the negative of the normal in that position, and this view ray will determine how the refl/spec will be calculated for that texel.

It is easiest to visualize on the ground plane in you image, the reflection direction is always straight up.

 

To fix it you would need to change the shader so that the "eye" direction used for shading would not be the actual view ray, but the direction from the shaded point to a point of your choosing. (the virtual "camera"). Might even be an easy fix.

For most cases this would be a bad idea, as the reflection/spec would look even worse when viewed from any other direction. As it is, it should at least look remotely "ok" from any direction..

Link to comment
Share on other sites

Thanks a lot for the clarification i start to understand !

 

When you said :

 

 

change the shader so that the "eye" direction used for shading would not be the actual view ray

 

which shader are you talking about ?

- the UV lens shader ?

- or the surface shader apply to my objects ?

 

EDIT : sorry for the dumb question i think you mean lens shader !

i'm gonna try to make this works !

Edited by sebkaine
Link to comment
Share on other sites

well i am getting closer thanks to your indication ! :)

 

now the render and the bake lightmap match at 95% !

i have replace the N channel in the prepass by the vector E = negate(normalize(I)).

 

but the face that are opposite to the camera are now black !

i need to figure how they can be shaded correctly like in V-Ray bake ?

 

if you have any idea that would be great !

 

 

post-6698-0-68613400-1426618747_thumb.jp

Link to comment
Share on other sites

Oh, I definitely meant the actual shader used to do the baking, not the lens shader.

 

The lens shader uses the prepass position and normal to find the correct location in the scene - the point that corresponds to the uv-coordinates of a texel in the final color map. You should not mess with those.

 

When the shader for the actual surface is executed for a surface point the "camera" location is a point just a bit above the surface, and view ray direction is the negative normal direction. This ray is used to determine the reflection direction, which will consequently end up as being the positive normal direction. What you can do, is feed a substitute view ray to the reflection/specular calculation, one that is different from the actual view ray. What we want to use here is the direction from your fake camera to the point being shaded - i.e. what the view ray would be if we were doing regular shading. Shading is done in camera space, so you might need to transform the vector, although my head hurts trying to think what the camera space actually _is_ in this situation.. :)

 

Here's a dry-run vopnet of what I approximately mean, untested, but should convey the idea:

 

post-2678-0-71182100-1426623232_thumb.jp

 

For the back-face problems you point at - they will always fail in some way or another. If you think what it is you are trying to bake here, 'what reflects towards the camera from this spot', it is absolutely undefined for this area. By decoupling diffuse and specular as above the back-facing areas will at least get the diffuse light. As I said, this is all a bad idea! :)

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...