Cameras with entities
Blitz3D Forums/Blitz3D Beginners Area/Cameras with entities
| ||
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? |
| ||
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? |
| ||
Yeah, you're going to have to hide the entities you don't want seen by each camera render. |
| ||
Maybe parent the entities to the camera then when the camera is hidden so will the entities be. |
| ||
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 |
| ||
hiding is more effective. less rendering, faster framerates. |
| ||
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 |
| ||
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. |
| ||
stevieg: lets make a small source to proof that. |
| ||
@t3K. If I must?! I'll post a demo of my method later. |
| ||
t3K, the extra rendering is nothing really. As Stevie says, blitz won't render, whats not in the cameras view. |
| ||
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. |
| ||
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 |
| ||
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... |
| ||
Told yeeee ;) |
| ||
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. |
| ||
@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 |
| ||
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. |
| ||
Yeah, sorry I agree checking each entity would be overkill :) |
| ||
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 |