Author Topic: any way to set the clipping plane on cameras?  (Read 4016 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
any way to set the clipping plane on cameras?
i wrote a camera script to allow the player to look around inside their cockpit. but it seems theres some issues relating to the clipping plane. it would appear its too far out sorta like the problem we had with early implementations of show ship. is there any way to change this?

also, how do you get to the eyepoint type listed in the scripting.html.
« Last Edit: November 25, 2007, 06:46:07 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: any way to set the clipping plane on cameras?
There seems to be couple of other 'inaccessible' types in the scripting.html too... On a quick check soundentry and sound at least look like they would be such.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: any way to set the clipping plane on cameras?
another camera thing, how do i render to the hud when using a camera? is there a special target i need to set?
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: any way to set the clipping plane on cameras?
The clipping plane thing is possible to fix; if I ever get around to working on the cameras, that and the FOV would be nice to have settable on a per-camera basis (So you could do zooms and such...or possibly cheat a ship out of the way by cropping it. :p)

Soundentry and sound were never implemented because there were some arbitrary distinctions in the sound system that seemed needless, would overly complicate scripting, and wouldn't be something that could be fixed in the future without keeping those effects in scripting. So I elected to leave them out rather than to try and hack them in.

You can't render to the HUD using the camera...maybe. It might be possible to:
Code: [Select]
ts.setCamera(myCamera)
gr.setTarget(myTarget)
mn.renderFrame()
gr.setTarget()
ts.setCamera()
to get a camera onto a texture that could be displayed on a HUD. Needless to say this would be extremely detrimental to performance, as you'd be rendering two full game frames per frame. It looks like this will work without env mapping, but I've never tested it. I also don't know what would happen if you made one of these cameras point at the display.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: any way to set the clipping plane on cameras?
i dont really want to render the camera to a texture (yet :P). i just want to be able to render stuff to the camera's hud.

heres a little idea of what im trying to accomplish
http://www.youtube.com/watch?v=-PM69ICOhsE
« Last Edit: November 25, 2007, 11:28:19 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: any way to set the clipping plane on cameras?
Technically speaking, all the current 'camera' objects do is to set the variables for the game rendering code's viewpoint. There is some code to control the HUD being displayed or not displayed when the camera code is used (It's set to "free camera" mode) and some related to hud-disable. So all you should have to do to use a HUD with a camera should be to either add it to the $On Frame or $On HUD Draw hooks.
-C

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: any way to set the clipping plane on cameras?
Hmm... This uses 'camera' http://www.hard-light.net/forums/index.php/topic,48280.0.html (corridor mode) and HUD gets drawn too.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: any way to set the clipping plane on cameras?
its probably because i still use the old $hud: global hook instead of the $On HUD Draw hook.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: any way to set the clipping plane on cameras?
Yeah, that's most likely it; the $HUD hook is disabled if either the HUD is disabled or the camera system is used. I've mantised a bug; the best solution (IMHO) would be to automatically disable the HUD when the camera system is used, and then reset the HUD back to its original state when no cameras are being used. That way you could simply call a toggleHUD() function to choose whether the HUD is shown or not after the setCamera() call.

Assuming it's compatible with current mods, of course.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: any way to set the clipping plane on cameras?
my huds working now, but i had to almost completely rewrite part of the reticle code. i had to go through the additional trouble of finding a reference point by which to aim the guns. so i used a point 10 units in front of the camera, which i then rotated it to world space and added the ships position to it i then projected this to the screen and scaled according to my multires system. another xform and a slightly slower script (similar to the problems i had with the turret script). but its sorta working. the gunsight isnt perfect but its enough to get some kills with. there is some innacuracy when looking at the reticle from sharp camera angles.

most of the innacuracy is due to how far the reference point is in front of the camera. putting it too close causes it to get clipped out, and the further out you go the more the lead skews when looking at it at an indirect angle.  when using the regular hud without the camera, i just used the center of the screen as a reference to compare the location of the ship and the location of the lead in 2d to figure out where to put draw the reticle. now its a 3d problem, but im still handeling it as a 2d problem. it would probibly be alot easyer just to draw the reference point and lead points directly, resulting in a more freespace esq sight. but whats the fun in that?
« Last Edit: November 27, 2007, 01:15:48 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: any way to set the clipping plane on cameras?
Where are the chokepoints?
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: any way to set the clipping plane on cameras?
my crappy programming skills :D
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN