Jump to content

How to bake/render "inverse panorama" of the object.


Recommended Posts

Like that.
https://blender.stackexchange.com/questions/89719/how-to-render-an-inverse-panorama

I want to bake for example fire as texture to cylinder with uv.
And where the cylinder in this case acts as the "camera".


I would be very grateful if you gave an example of setting up the shader for such baking.
 

123.png

bake_start_point.hip

  • Like 1
Link to comment
Share on other sites

You can set up an inward cylindrical projection (based screen coordinates ranging from -1 to 1) like this:

vector pos = v@P * M_PI;
float r = chf('radius');
float h = chf('height');

v@P.x = sin(pos.x) * r;
v@P.z = cos(pos.x) * r;
v@P.y *= h;

v@N = normalize( v@P * {-1, 0, -1} );

Inside a lens shader v@P would be called P and v@N would be I.

Unfortunately SideFX recently changed the way to create CVEX operators. Does anyone know how to use CVEX in Houdini 17?

 

Also make sure to check out Paul Ambrosiussen´s tutorial (for H16.5): https://www.sidefx.com/tutorials/lens-shaders-for-gamedev/

inverse_panorama.hiplc

inverse_panorama.png

  • Like 2
Link to comment
Share on other sites

  • 2 years later...
On 21/12/2018 at 1:08 PM, Iskander said:

Thank you,Konstantin,especially for amazing exhaustive link!

Hey guys!

Glad to see there is a little bit of light to this setup.

I am currently facing the exact same problem, where I need to render that inverted panorama. Wanted to ask if you guys were able to figure out how to define a CVEX lens shader in newer versions of Houdini, I am a little bit lost right now because at is noted the workflow for CVEX operators changed, and for what I have researched seems that maybe I am on the wrong direction. In some part of the documentation says that I need to make first an .vlf file and then turn it into an HDA, that is for Solaris/Karma which I don't think is what I need. Seems that it should be simpler than that. Thanks a lot and sorry for the trouble!

Cheers!

Link to comment
Share on other sites

On 15/12/2018 at 7:24 PM, konstantin magnus said:

You can set up an inward cylindrical projection (based screen coordinates ranging from -1 to 1) like this:


vector pos = v@P * M_PI;
float r = chf('radius');
float h = chf('height');

v@P.x = sin(pos.x) * r;
v@P.z = cos(pos.x) * r;
v@P.y *= h;

v@N = normalize( v@P * {-1, 0, -1} );

Inside a lens shader v@P would be called P and v@N would be I.

Unfortunately SideFX recently changed the way to create CVEX operators. Does anyone know how to use CVEX in Houdini 17?

 

Also make sure to check out Paul Ambrosiussen´s tutorial (for H16.5): https://www.sidefx.com/tutorials/lens-shaders-for-gamedev/

inverse_panorama.hiplc

inverse_panorama.png

Hey guys! @Iskander @konstantin magnus

So I managed to get the CVEX working on newer versions of Houdini, turns out that the CVEX operator, becomes a CVEX VOP that can go inside a CVEX Shader Builder operator inside the shop context.
Said that, I was able to follow Paul's instruction to get an idea of how the lens shaders should work, but now I'm a little bit stuck on reproducing the inverse panorama.
I'm getting something like this at the moment with the following code on my lens shader:

#pragma opname        cylindricalCamera
#pragma oplabel         "Cylindrical Camera"
 
#pragma hint    x       hidden
#pragma hint    y       hidden
#pragma hint    Time    hidden
#pragma hint    P       hidden
#pragma hint    I       hidden
 
#pragma range   r 0 10
#pragma range   h 0 10
 
#include "math.h"

cvex
cylindricalCamera(
    
    float x = 0;
    float y = 0;
    float Time = 0;
    
    export vector P = 0; //Ray origin in Camera space
    export vector I = 0; //Ray direction in Camera Space
    export int valid = 1; //Whether the sample is valid for measuring
    
    //R and H of cylinder
    float r = 10;
    float h = 4;
    )
{
    vector pos = P * PI;
    P.x = sin(pos.x) * r;
    P.z = cos(pos.x) * r;
    P.y *= h;
    I = normalize(P * {-1 , 0 ,-1});     
}

For what it seems, looks like the sample position is not really changing at all. Some ideas would be greatly appreciated!

Cheers!

CylindricalRender.PNG

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...