Jump to content
Iskander

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×