Jump to content

Is it possible to have a camera screen be a texture?


MisterGravity
 Share

Recommended Posts

http://www.leadwerks.com/werkspace/topic/8103-gameplay-tutorial-requests-here/

 

Last link on the first page. Bookmark that topic because we'll be adding lots to it and I will update the first page to make it easier to fine smile.png

 

Thanks Rick! You come through again!

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

To be fair Shadmar made that script smile.png

 

Do you think Shadmar or anyone has an example project I could download on this? The script is a little vague on the first three variables.

 

Well wait a minute now, I've been playing with it and I what I've done is point a camera straight down over an area, and then display that on a screen. Unfortunately, I can't see my first person camera anymore. I just see my hands carrying a gun around from a top down view, which is a little weird.

 

How can I still see what I need to see first person, but the camera view be the one I've setup?

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

For the tracking pivot variable, just place a pivot in your scene. The pivot has a position and direction (you can rotate it). The position & direction the pivot is pointing, will be where the camera gets placed so it's what the camera will see. You'll probably have to play around and trial and error get get the perfect direction it's pointing at.

 

The main camera is the camera. Place a camera in your scene and drag it to this parameter

 

RenderToMaterial can be any material. I believe whatever is used in the material as the texture gets overwritten anyway.

Link to comment
Share on other sites

For the tracking pivot variable, just place a pivot in your scene. The pivot has a position and direction (you can rotate it). The position & direction the pivot is pointing, will be where the camera gets placed so it's what the camera will see. You'll probably have to play around and trial and error get get the perfect direction it's pointing at.

 

The main camera is the camera. Place a camera in your scene and drag it to this parameter

 

RenderToMaterial can be any material. I believe whatever is used in the material as the texture gets overwritten anyway.

 

I got that far, but the thing is, when I bring a new Misc / Camera into the scene, it becomes what I see all the time when I run the game. I lost my first-person-camera eyes when I walk around. How do I get that back, but keep the rest of it working? (The camera I placed IS displaying what it sees on the screen I setup, I just lost my own first person viewpoint.)

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

You only want 1 camera ever in your scene (for the most part). This script will take your camera, move it to the pivot, take a "snapshot", then restore where it was all before you know it even did it.

 

Okay, I'm soooo almost there. I replaced the camera I placed in the scene with a 2nd pivot, and when I run it, I see what "I see", as in my first person camera on the screen. How can I point the camera/pivot if it doesn't have a cone like lights and cameras do?

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

Trial and error with the rotation smile.png

 

Also, are you using the same material you passed to the script on some csg or something? That will be what the "security camera" sees.

 

You say trial and error, but I'm not even seeing directions to point to. It's just a pivot, like a waypoint with no cone that you would send Moving Platforms to. See, take a look:

 

tumblr_mzbc6cwOBc1qk5t55o1_1280.jpg

 

 

tumblr_mzbci7TCQE1qk5t55o1_1280.jpg

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

Here's the deal. If you are using the base FPSPlayer script this won't work because that creates a camera in itself. (This is why I don't like that script). You don't need a pivot to replace the camera. What you need to do if look at my teleport tutorial and pay attention to the beginning where I change teh FPSPlayer script to accept a camera as a parameter instead of making one in itself. This allows you to drag a camera entity in your scene as the main camera that you can drag into the FPSPlayer script (after you make the change in my tutorial) AND drag it to this script as well.

 

The FPSPlayer script is great for a quick drop and drag and it just works, but with it making it's own camera, it sort of screws up other scripts that need to use a Camera. This is why I changed the script in my tutorial.

Link to comment
Share on other sites

This is a really good idea for a new example map for us to add.

 

It might be necessary to add an extra commands to make it easier, like set a texture for a camera to automatically always render to. It's certainly possible right now through the API we have, but if we had an official example I could use that to figure out how to make it *really* easy to set up.

 

 

Link to comment
Share on other sites

I'd be interested in seeing your implementation.

 

I'll make a video and or write out exactly what we did. Rick is a brilliant, brilliant guy. Josh, now might be a good time to BEG you for a "point to" feature. As in, this light should point to that spot. Or that pivot should point to that spot. A simple static point to would be fantastic. A dynamic following pointer would be the bee's knees. All this guess work on in a three-dimensional plane is exasperating.

 

You know, now that I think about it, is there a way to get the x,y,z coordinates of a location, like where your mouse pointer is, and then put that in a "point to x,y,z" of a light or pivot? Is there already an easier way than the rotate buttons, test, try again, test, try again...etc.?

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

The script relys on a camera you can link in. FPSplayer, creates a camera which should be disabled and linked in via Script.Camara instead.

The pivot is like you said the position/rortation (matrix) where maincamera will be moved and snapshot into the buffer and back again.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Well, that might was poorly worded - rick suggests pure object orientation with the camera being an object, the "only" other option would be self aware/containing objects ( with a own camera using disable old/ enable new ). Now, in le2 framework I "must" use the later because the ears ( listener ) are at the main cameras position "always" - fobaring positional audio e.g. light humming etc ...

 

that's was what I wanted to point out - if you want to have it extensible ... or as a base etc.

 

for beginner : sorry'bout all the "" ... le2 programmer know ( or should remember ) all the little issues we had ... and still have tbh.

AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3

zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5

 

adv_banner-april2012_720x150_tex01.png

 

Xxploration FPS in progress ...

Link to comment
Share on other sites

There is actually one last issue I'm having with this that I can't seem to overcome. If my player has a Weapon equipped, like "autopistol.pfb", then the security screen display also shows my hand holding that pistol. Is it possible to draw the camera without it also seeing that?

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

Yes, in the script link in your gun/hand and add before and after render() .., something like this :

 

gun:Hide()
App.world:Render() -- render to buffer your pivots matrix
gun:Show()

 

Yep, I bet that is going to do it. Before you give me any answers on how to link in my gun/hand, let me try to figure that out on my own. I'm getting better at Lua by the minute. :)

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

Link to comment
Share on other sites

This script is capable of having multiple security cameras, right? I've created 2 different securityCameraTextures, put them on two different surfaces, created two different pivots and pointed them were I want them to be, and I'm still amazingly seeing the same screen on both of them which should absolutely not be possible since the textures they're going to are completely different from each other.

 

tumblr_mzi40zuuLm1qk5t55o1_1280.jpg

I'm sure I'll have a million questions in my quest to master the Leadwerks Engine. Thank you for your patience.

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.

 Share

×
×
  • Create New...