Jump to content

Distance From Camera


Visual Cortex Lab

Recommended Posts

Hi,

I need to build a sort of HDA wich will generate woods, grass, and big areas of vegetation. Camera will move really close to the field therefore i was thinking about making an automatic Lod which loads the lower resolution as the object (copied) get far from camera.

I post what I did during last two days and i'd like your impressions and (i'm sure its much more easy to do) your advices to do this...

This is again for my demo I've to do here to convince company to include Houdini as tool for FX here.... so i need yoru help on it :) ...

I figured how to load XSI<->Houdini stuffs i need so i'm ok with such problem... now i need some cool effects to show something would make 'em get Houdini ;)

cheers.

camera_distance_lod3.zip

Link to comment
Share on other sites

Maybe, as I say I never used it.... :)

edit:

Oh I see LOD is just for display but Polyreduce has a distance tab that I guess works in a similiar way.

Anyhoo, sum][one is actually building stuff at different res in the first place.

The other options you have I guess are to using instancing or even instancing hda's I think that has been discussed on here before.

If you end up with a lot of detail I would have thought instancing is way more efficient memory wise for the renderer.

Or for the really distance stuff rendering as cards/sprites would probably be fine too.

Lots of options, but I think this is a fairly big subject, at least with Houdini there are a lot of ways of handling this so if one way fails there is always another option.

Link to comment
Share on other sites

having no internet at home sucks...

anyway ...

i notice that nobody actually answered to the real question... how to properly get distance from camera.

I post here what's my results after these last 4 days working on it (and today showing to my supervisor.. today its the day.

what i neede to do were a vegetation generator.. for environments and background of all kind of woods or grass.. and I considered the LOD for the final geometry generation..

now i'm using simple geometry.. but for the final scenes high detail geometry (but much less visible object) will be involved. this scene was just a "overall" test to show here ... your impression/advices are really welcomed. ah.. nothing really new here.. this scene came out thanks to the Forest Challenge wich gave me lot of helps on this.

I wish an (or more) HDA will be the result to build our Woods and Grass field. the resulting geometry will then be exported and loaded into XSI for shading/rendering. (I cant assume we'll also be able to render it yet in Houdini).

cheers.

I lowered the values for loading times... please set "Grass source" to something around 100000 or higher and alberi source to 500 or higher.

terrain_builder24_low.zip

Link to comment
Share on other sites

here's a couple of ways to get the distance to the camera, there's the distance expression which just needs the x,y,z of two points and will return the distance between them.

Or in chops you can use the object chop and set the compute option to distance.

If you are copy stamping you'd probably need the first one where one x,y,z would be the point position you are stamping to and the other would be the position of the camera. Just make sure they are both in the same space to remove any parenting. The best way might be to just objectmerge one point from the camera into your object and use that to get the position of the camera from.

There are problem other ways too if this doesn't work for you.

Link to comment
Share on other sites

here's a couple of ways to get the distance to the camera, there's the distance expression which just needs the x,y,z of two points and will return the distance between them.

Or in chops you can use the object chop and set the compute option to distance.

If you are copy stamping you'd probably need the first one where one x,y,z would be the point position you are stamping to and the other would be the position of the camera. Just make sure they are both in the same space to remove any parenting. The best way might be to just objectmerge one point from the camera into your object and use that to get the position of the camera from.

There are problem other ways too if this doesn't work for you.

22307[/snapback]

ok.. then that's the way (similar) i've used.... take a look at my scene if you got spare time.. i'd like some impressions/advices/critiques to it :)

In my scene I';m not using the distance to camera tought... but to a refernce object because i wanna move it indipendently from the camera...

Link to comment
Share on other sites

I have also another question about my scene.

the scenario is pretty clear now I hope.. i need to generate that amount of geometry to then be exported and imported in XSI for shading... now..

i tried the Particle Instancing.... but is that possibile (by not using COPY) to archieve same result as my sccene?... advantages ? (remind.. i just need the geometry.

cheers and thanks.

Link to comment
Share on other sites

That sounds a little tricky. Since you have to actually create the geometry you can't leave it to mantra to generate it on demand. That suggests the copy sop as you say.

However you might hit limits on the amount of geometry one copy sop can handle. So two thoughts spring to mind, either split things up into multiple copy sops or somehow make the generation time dependent, that way you could append to your file over time, slowly populating the scene frame by frame. At the end you would have all your geometry but it would have only needed to be generated in pieces. Something little my forloop sops would do that for you, or you can do it with a simple script.

Just throwing out ideas, I've never actually needed to do this, I'm surprised no one here has though.

Link to comment
Share on other sites

Just throwing out ideas, I've never actually needed to do this, I'm surprised no one here has though.

22322[/snapback]

I'm surprised as well... honestly.

seems like I'm trying to archieve something so "strange" ... or everybuddy is too buzy for the Annual Houdini Hacker challenge.. :P

btw.. i got your point.. and yeah..i'll have to take care about amount of geometry (Houdini aint happy when i reach over 2gb ram ... it just close down loosing all my work, happened few times since i started this test).

I'll keep you updated.. i think is just a matter of finding the best setup for this. that said.. i must also add that using LOD, the amount of geometry aint *that* much at the end of copy SOP.

Link to comment
Share on other sites

to help on the geometry loads, why not just use bounding boxes for display and the actual geometry for rendering.. for testing out the LOD, you could have different subdivided levels of the boxes (with a high crease overide to maintain box form) to represent the detail on the original geometry. i wouldn't think you'd need to see the actual geometry inside the viewport.. esp. if you're copying it over and over.

Link to comment
Share on other sites

to help on the geometry loads, why not just use bounding boxes for display and the actual geometry for rendering.. for testing out the LOD, you could have different subdivided levels of the boxes (with a high crease overide to maintain box form) to represent the detail on the original geometry. i wouldn't think you'd need to see the actual geometry inside the viewport.. esp. if you're copying it over and over.

22341[/snapback]

I might had not been too clear on this topic.... my needs are generating geometry to be exported into XSI ... nothing more. i dont need rendering... i just need to generate large amount of geometry procedurally and apply UV projection ... which is not a problem actually.. i archivied all I needed....

what I'm trying to optimize.. is the LOD generation considering distance to camera (or to dummy object in my case)

I'll need to generate large environments, large grass fields, large cornfields .. and so on.. I'll also need to create lot of particles FX (smokes and dusts and so on) but first i need to show what its much simpler to create in houdini compared to XSI.

if you take a look at my scene you'll find that i'm sorting point of the source copy template (grids or scattered points) to such dummy object.. and stamping a variable which multiplied by $PT number gives me a sort of LOD switch .. but since its *contrained* to the template $PT also, i cant have proper LOD ... I'll prepare a simpler scene to explain my problem here.... but anyway .. i dont need isntances.. i dont need bounding boxes.. I need proper geometry to be exported as OBJ, and then shaded/rendered in XSI .

I need to NOT force the company understand Mantra or MR integration yet ... what I'm pointing at, for obvious reasons, is the easier way to let the company understand that Houdini CAN help here on many aspect.. and geometry generation for such big stuffs is the best way to show why i'm pointing at Houdini. Then, once they get the power, I'll go further and introduce benefits of all the rest, rendering included.

Now My challenge is to show in the easier way why I'm talking about Houdini to them.

hope this clarifies a bit more :) and sorry for my bad english.

cheers

Link to comment
Share on other sites

actually, i got what you were saying.. but you still can have that setup and have it set to a geometry rop..

the last comment you made was about hitting high geometry loads.. so i suggested switching them out for bounding boxes.. and while you're testing out the lod system, use sub-d versions of the boxes as reference for the different "levels".. that way you're not loading the real geometry until render or output or save or whatever you wanna call it.. point is, it's not in your viewport and causing a major slowdown..

just a quick example.. have your standard geometry of trees, plants, grass etc and make bounding boxes out of them. immediately right afterwards, tie them both in to a switch sop with the bounding box being first. then have your copy sops and attributes and what not until your final display sop.. on the geometry rop, have a pre and post render script to opparm the switch sop to move over to the real geometry before output, and then put back afterwards..

now see what i'm saying ;)

Link to comment
Share on other sites

well.. you could do it based off of point sorting.. or you could put distance information in to an attribute that sits on each point. or heck, attach different size spheres centered around your dummy point and make bounding groups of the template points the reside within each of those spheres..

basically all the same thing i guess tho.. i.e. using distance expressions to somehow have the template points know which geometries to load/copy.. i dunno, never had to do it before, but i *think* that's how I'd start off trying things.. :rolleyes:

Link to comment
Share on other sites

I've been away all week so I haven't read this thread too closely. To get the distance from point to camera, I think the originoffset() expression can do this. For simply the depth of the point from the camera, something along these lines in your AttribCreate SOP ...

-1*originoffset("/obj/cam1", vector3(0,0,0), "..", vector3($TX,$TY,$TZ), "TZ")

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