Page 1 of 1

purebasic with blitz3d SDK

Posted: Mon Jan 25, 2010 1:57 am
by ChebbyShabby
i'm kind of stuck here. i've started a project with the blitz3d sdk (it's over 2000 lines long) and then i find out that i can't change the FOV of the camera using the sdk commands. is there any way i can do this from purebasic?

Re: purebasic with blitz3d SDK

Posted: Mon Jan 25, 2010 3:19 am
by Rook Zimbabwe
Let me look at my Blitz3D docs...
Camera Range
Camera range determines how far into the distance a camera can 'see'. You specify 2 values for camera range - a near value and a far value. All rendering is clipped to this range.

Its a good idea to try and keep the near value as high as possible, while keeping the far value as low as possible. This helps to minimize z-buffer problems like 'jaggies'. By default, the near value for a new camera is 1, and the far value is 1000.

To change the camera range, use the CameraRange command:


;Sets the near range to 5 and the far range to 5000
CameraRange camera,5,5000



Camera Zoom
Changing a cameras zoom allows you to 'zoom-in' or 'zoom-out' of the action in the world. The default zoom value for a new camera is 1. Zoom values greater than 1 will cause a 'zoom-in' effect, while zoom values less than 1 will cause a 'zoom-out'. Zoom values should never be set at 0 or less!

The CameraZoom command controls camera zoom:


;Zoom-in a bit!
CameraZoom camera,1.5
I don't know the calling consttants though... did they not give you a help file with this? It is a part of the download when I bought the lib??? :mrgreen:

Re: purebasic with blitz3d SDK

Posted: Mon Jan 25, 2010 3:37 am
by ChebbyShabby
Rook Zimbabwe wrote:Let me look at my Blitz3D docs...
Camera Range
Camera range determines how far into the distance a camera can 'see'. You specify 2 values for camera range - a near value and a far value. All rendering is clipped to this range.

Its a good idea to try and keep the near value as high as possible, while keeping the far value as low as possible. This helps to minimize z-buffer problems like 'jaggies'. By default, the near value for a new camera is 1, and the far value is 1000.

To change the camera range, use the CameraRange command:


;Sets the near range to 5 and the far range to 5000
CameraRange camera,5,5000



Camera Zoom
Changing a cameras zoom allows you to 'zoom-in' or 'zoom-out' of the action in the world. The default zoom value for a new camera is 1. Zoom values greater than 1 will cause a 'zoom-in' effect, while zoom values less than 1 will cause a 'zoom-out'. Zoom values should never be set at 0 or less!

The CameraZoom command controls camera zoom:


;Zoom-in a bit!
CameraZoom camera,1.5
I don't know the calling consttants though... did they not give you a help file with this? It is a part of the download when I bought the lib??? :mrgreen:
erm... i'm using the blitz3d SDK -- not all blitz3d functions are available. and the 2 functions above have nothing to do with the focal length of the camera (or field of view). i think the function is 'SetCameraFOV' or something.

Re: purebasic with blitz3d SDK

Posted: Mon Jan 25, 2010 3:44 am
by Rook Zimbabwe
Actually i just used those two... I do not remember the FOV commands...
let me see if there is anything with FOV???

Nope...

You use what I showed you,

http://www.blitzbasic.com/Community/pos ... 645#710263

http://www.blitzbasic.com/Community/pos ... 896#151107

linkage

SSWIFT suggests rescaling the camera entity (I haven't done that ever but that should work... His conde is included in the second quoteed link

recaapped here per SSWIFT on Blitz3D forum:

Code: Select all

Function HUD_Camera_FOV_Correction(ThisCamera)

	Scale640x480#  = 480.0 / 640.0
	ScaleThisRes#  = Float(GraphicsHeight()) / Float(GraphicsWidth())
	Rescale# = Scale640x480# / ScaleThisRes#
	ScaleEntity ThisCamera, 1, Rescale#, 1, True
	
End Function
:mrgreen:

Both ideas should work though... you just gotta play around with it a bit! :D

Re: purebasic with blitz3d SDK

Posted: Mon Jan 25, 2010 9:45 pm
by ChebbyShabby
my god... it worked. thanks, man. you are a life saver :). took me a while to notice the difference though lol.

Re: purebasic with blitz3d SDK

Posted: Mon Jan 25, 2010 11:00 pm
by Kuron
Ralph gave you more help than you would get on the official forums :wink: