Cameras with entities

Blitz3D Forums/Blitz3D Beginners Area/Cameras with entities

mindstorms(Posted 2006) [#1]
is there any way to make an entity show only in one camera? I have dials like mph and such, but you can see them flying around from the other airplanes. Is there any way to fix this?


jhocking(Posted 2006) [#2]
Maybe you want the command HideEntity? You're going to have to be more specific, like posting code that demonstrates your problem, for us to understand what exactly you need explained. What is the situation here? What other cameras? Why is the player flying the other planes?


big10p(Posted 2006) [#3]
Yeah, you're going to have to hide the entities you don't want seen by each camera render.


Shambler(Posted 2006) [#4]
Maybe parent the entities to the camera then when the camera is hidden so will the entities be.


Stevie G(Posted 2006) [#5]
I'm assuming you're talking about two player split screen here? If it is then you can use an approach like so ....

Set up a GUI camera with a very low range, position it far enough away from everything so that your planes will never be near it. Set the cameraclsmode so that the previous camera renders are preserved and set the entityorder on the GUIcamera to be drawn last.

GUIcamera = CreateCamera()
CameraClsMode GUIcamera,False,True
CameraRange GUIcamera, .1,5
PositionEntity GUIcamera, 100000,100000,100000
EntityOrder GUIcamera,-999


Parent your dials to this camera ( you will need to play about with their offset to ensure they fit on screen properly ). During renderworld() you then shouldn't have to hide anything.

Stevie


t3K|Mac(Posted 2006) [#6]
hiding is more effective. less rendering, faster framerates.


Stevie G(Posted 2006) [#7]

hiding is more effective. less rendering, faster framerates.



Sorry don't agree in this situation. Blitz will automatically cull entities outwith the camera near / far clip range so it's not doing any extra work here. Same amount of rendering / same framerate / less hiding and showing entities.

Stevie


mindstorms(Posted 2006) [#8]
I was talking about splitscreen or possible multiplayer over internet. As player 2, you can see player1 instruments hovering near player1's plane.

stevie g: thanks for the tip, i will try that.


t3K|Mac(Posted 2006) [#9]
stevieg: lets make a small source to proof that.


Stevie G(Posted 2006) [#10]
@t3K. If I must?! I'll post a demo of my method later.


Ross C(Posted 2006) [#11]
t3K, the extra rendering is nothing really. As Stevie says, blitz won't render, whats not in the cameras view.


mindstorms(Posted 2006) [#12]
is there any way to make the cameras render independantly of each other? this could be more what i am looking for.

stevieg: i could not get your idea to work for the crosshairs which is a object that stays at a certain distance from the front of the player.


Stevie G(Posted 2006) [#13]
This is a different issue from the dials then. They do not have to be attached to the planes.

For the cross hairs you will need to do a bit of hiding and showing like this ....


CameraProjMode Camera1, 1
showentity CrossHair1
CameraProjMode Camera2, 0
hideentity CrossHair2
renderworld()
cameraprojmode Camera1, 0
hideentity CrossHair1
cameraprojmode Camera2, 1
showentity CrossHair2
renderworld()


Apparently cameraprojmode cam, 0 is faster than hideentity cam.

Hope this helps.

Stevie


t3K|Mac(Posted 2006) [#14]
stevie: i tried both methods, there is no method faster or slower (if your second cam is faaaaaaaaaaar away from your scene)... you're right. i've thought i could squeeze out a few ms...


Stevie G(Posted 2006) [#15]
Told yeeee ;)


@rtur(Posted 2006) [#16]
If u have a lot of objects, blitz processing it and check if object in frustum of camera. Try this code, and then unremark HideEntity cub[i] string. And you will see the difference.


So it is better to hide entityes manualy.


Stevie G(Posted 2006) [#17]
@rtur

The guy was talking about split-screen ( where each plane had dials and whatnot ) so how is this example relevant and exactly what does this prove?

Not very much is the answer to that. Obviously, hiding all objects before rendering will be faster than asking Blitz to cull them. It doesn't take a rocket scientist to work that one out!

In reality, rather than using Blitz's inbuilt culling system, you would be checking the distance from the camera for each entity before hiding or showing it. Overheads on 1000 objects would likely be slower.

I never said my method would be faster but it's MY preferred method for split screen and IMO more elegant.

Stevie


@rtur(Posted 2006) [#18]
Hmm didn't read whole topic :)
Sorry.

>In reality, rather than using Blitz's inbuilt culling >system, you would be checking the distance from the >camera for each entity before hiding or showing it. >Overheads on 1000 objects would likely be slower.
BTW you don't need to check distance on each entity. You can split them into tree and check only few times.


Stevie G(Posted 2006) [#19]
Yeah, sorry I agree checking each entity would be overkill :)


mindstorms(Posted 2006) [#20]
Using both of those teqniques works! It slows the game down by about 5 frames per second, but I can live with that!
Thanks, especially Steive G