Jump to content

Problem Getting Camera.RenderToTarget Working


mdgunn
 Share

Recommended Posts

EDIT(My post title a bit mis-leading - not sure I can edit - I'm really trying to set things in the editor with minimal code, so setting a camera 'Render Target' not setting this in code).

 

 

I was fairly sure I'd had this working before but I can't remember if there was anything special I did to do it....

 

I want to render to a texture like someone did here...

 

kHjVpBC.jpg

 

 

Here is my non-working version...

 

6cGN0CN.jpg

 

 

QUESTION: If you are setting the 'Render Target' on a camera in the EDITOR what else do you actually need to do to get the image appearing on a brush/model?

 

I thought setting render target in the editor to a texture and setting that texture on a brush might be enough (though I suspected it would not be that simple too).

 

I've seen the security cam scripts but it seems like these are doing some of the work that setting the Render Target of a cam in the editor is probably doing (i.e. rendering the texture for you).

 

My texture stays black. I am using the standard FPS controller (which creates its own camera) and another camera set so I can set the position and the Render Target. Is this maybe the problem where maybe 2 cameras are active at once? Was thinking setting 'Render Target' on a camera handled any switching of cameras as it needed when running.

 

Any ideas what I need to do to get this working?

Link to comment
Share on other sites

Been a while since I used it but I believe you just have to set the monitor's material to use the same texture you set for the camera, which would probably be monitor.mat.

edit: Just tested. I set a csg to greengrid.mat and the camera's render texture to greengrid.tex. This is looking at it with the FPS player.

post-12583-0-14550500-1492038139_thumb.jpg

---

Scott

 

Using Windows 7 Ultimate 64 bit/Core I7-2700K @ 4312mhz/24G RAM/Nvidia GTX 1060

Link to comment
Share on other sites

Sounds like I'm doing the same thing. I'm on a laptop with integrated Intel graphics, which is very usable with LeadWerks for simple stuff, but I think this rendering to a material from a camera may not work.

 

I can't test this on my desktop for a few more days but I suspect it will work when I retest there.

 

Thanks for the feedback.

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...