RTT - Render To Texture - Scopes Possible?
by J0linar · in Torque 3D Beginner · 02/05/2013 (8:06 pm) · 7 replies
Hi all
so far what i understand is that we have render to texture in T3D MIT
and ofc i am aware of the fxGuiSnooper Resource www.garagegames.com/community/forums/viewthread/127227
I implemented it and it is working as it should.
Thing is how would one/ or would it be even possible to use this on a WeaponShape?
Another Thing i realized is when u look around with the fxGuiSnooper u can see the FPS Mesh (depending on wich view) and ofc the thirdperson one aswell.
What i would like is to achieve some kind of RTT Scope

Any Help or advice would be great, thx.
so far what i understand is that we have render to texture in T3D MIT
and ofc i am aware of the fxGuiSnooper Resource www.garagegames.com/community/forums/viewthread/127227
I implemented it and it is working as it should.
Thing is how would one/ or would it be even possible to use this on a WeaponShape?
Another Thing i realized is when u look around with the fxGuiSnooper u can see the FPS Mesh (depending on wich view) and ofc the thirdperson one aswell.
What i would like is to achieve some kind of RTT Scope

Any Help or advice would be great, thx.
About the author
http://j0linar.blogspot.co.at/
#2
As to your problem I think you need to find the part in the code that defines the rendering of the scene. Then right after the scene render, when every object has had a chance to participate you need to inject and adjust the render to fit your viewing angle and distance and render again for your scope, but this time to a texture rendering target. One issue might be distant objects are not rendered that should show up in a scope. If that is the case then you might need to rebuild the scene. Again I think all of this is done in the render managers.
I tried using the render managers like they are used the imposter rtt code, but I ended up with artifacts on the objects shadow. So I was missing something there too. So look at how imposters work, that might give you some ideas about how to create a scene using managers. Also, try and find where the whole scene is managed and see what can be done there. You will have to find out which objects are in view a re-render them to your texture target.
You may be right though. It might be easier to create a custom GameTSCtrl and change its render target. That is outside what I am doing, but it might be a better approach for your task. I can help with setting up a render target except I am still working through how to properly setup the matrices. But I know how to create an target and use it.
02/21/2013 (2:44 pm)
I am still struggling with just creating my example. I am struggling with the use of matrices. I know this is standard 3D stuff, but if you don't know it you don't know it.As to your problem I think you need to find the part in the code that defines the rendering of the scene. Then right after the scene render, when every object has had a chance to participate you need to inject and adjust the render to fit your viewing angle and distance and render again for your scope, but this time to a texture rendering target. One issue might be distant objects are not rendered that should show up in a scope. If that is the case then you might need to rebuild the scene. Again I think all of this is done in the render managers.
I tried using the render managers like they are used the imposter rtt code, but I ended up with artifacts on the objects shadow. So I was missing something there too. So look at how imposters work, that might give you some ideas about how to create a scene using managers. Also, try and find where the whole scene is managed and see what can be done there. You will have to find out which objects are in view a re-render them to your texture target.
You may be right though. It might be easier to create a custom GameTSCtrl and change its render target. That is outside what I am doing, but it might be a better approach for your task. I can help with setting up a render target except I am still working through how to properly setup the matrices. But I know how to create an target and use it.
#3
02/21/2013 (3:03 pm)
I would just render it and put it in as an overlay image in the GUI editor.
#4
and ye i read your latest progress report, was hoping to hear something new
even if its a bug or problem it shows your passion, anyways thx for the tip
and @ Duion, well problem is if you have a model/ weapon or whatever that is actually moving = weird overlay, isnt it?
or proof me wrong but seriously this just doesnt work
will see if i can get somethin done, a custom camera a scene into scene render/ is the way most if not all other engines (i personally know) are doing this. udk/ unity and idtech
02/21/2013 (3:03 pm)
thx Frank, ye am not really sure how i would even approach thisand ye i read your latest progress report, was hoping to hear something new
even if its a bug or problem it shows your passion, anyways thx for the tip
and @ Duion, well problem is if you have a model/ weapon or whatever that is actually moving = weird overlay, isnt it?
or proof me wrong but seriously this just doesnt work
will see if i can get somethin done, a custom camera a scene into scene render/ is the way most if not all other engines (i personally know) are doing this. udk/ unity and idtech
#5
02/21/2013 (3:21 pm)
In Arma2 for example you cannot move when you aim/shoot, problem solved ;)
#6
I think I may have found some useful info. If you look in GuiTSCtrl::onRender you will see how the scene is setup as far as transforms. You will also notice that the render occurs in this function. So if you made a custom GuiTSCtrl (custom GameTSCtrl) is the actual I think, then you could have the RTT for the scope happen right after the main render occurs. That way a lot of your stuff is setup. Then you would need to create your render target, adjust the frustum (might be other stuff to adjust) for a square aspect ratio, adjust the position of the camera (view matrix), and then you could do a render. Oh, wait, hmmm, this might need to happen before the main render so objects in the main render will get the latest render.
Or, I think you were talking about using an entirely separate gametsctrl so it could only just render to the scope texture. That might be easier. The camera for that could be mounted on the weapon scope. No weapon scope no render. Also, that object (gametsctrl) could be created on the fly whenever the scope is attached. So yeah, I think that is the way to go. a custom gametsctrl.
Edit:
A simpler one could be done in script only. If you just switch cameras to a camera on the scope then you would get the effect, but not simultaneous renders. If you want both then that won't do it.
02/21/2013 (11:46 pm)
@J0linar,I think I may have found some useful info. If you look in GuiTSCtrl::onRender you will see how the scene is setup as far as transforms. You will also notice that the render occurs in this function. So if you made a custom GuiTSCtrl (custom GameTSCtrl) is the actual I think, then you could have the RTT for the scope happen right after the main render occurs. That way a lot of your stuff is setup. Then you would need to create your render target, adjust the frustum (might be other stuff to adjust) for a square aspect ratio, adjust the position of the camera (view matrix), and then you could do a render. Oh, wait, hmmm, this might need to happen before the main render so objects in the main render will get the latest render.
Or, I think you were talking about using an entirely separate gametsctrl so it could only just render to the scope texture. That might be easier. The camera for that could be mounted on the weapon scope. No weapon scope no render. Also, that object (gametsctrl) could be created on the fly whenever the scope is attached. So yeah, I think that is the way to go. a custom gametsctrl.
Edit:
A simpler one could be done in script only. If you just switch cameras to a camera on the scope then you would get the effect, but not simultaneous renders. If you want both then that won't do it.
#7
and sry if i distracted you from your rtt stuff,
and yes i was thinking about using a sparate gametsctrl/ i did found some info here and there but tbh am not quiet sure how i would mount it onto scope/ that was the idea from the beginning
when/ if Player uses Weapon with Scope = rtt on scope
the whole thing wouldnt be just limited to a simple scope, i mean its the thing to get it started,
look at this video
www.youtube.com/watch?v=DsI--uJxgpE around min1 its sorta interesting
anyways i will keep trying :) again thx
and gl with your rtt stuff
02/22/2013 (9:24 am)
hey Frank thanksand sry if i distracted you from your rtt stuff,
and yes i was thinking about using a sparate gametsctrl/ i did found some info here and there but tbh am not quiet sure how i would mount it onto scope/ that was the idea from the beginning
when/ if Player uses Weapon with Scope = rtt on scope
the whole thing wouldnt be just limited to a simple scope, i mean its the thing to get it started,
look at this video
www.youtube.com/watch?v=DsI--uJxgpE around min1 its sorta interesting
anyways i will keep trying :) again thx
and gl with your rtt stuff
J0linar
Am still far away from understanding how to achieve this,
what i found out so far is that when using a 2nd Gui
this could partially be achieved.
My question would be is it possible to render a gui or let me rephrase this
render a 2nd camera view onto a object? (in stock t3d 1.2)
So far i found out that GameTSCtrl(CameraGui) is the key now if someone has a idea how this could be made working on a ingame model (its texture)
that would be a life saver.
on a sidenote i did some reading on Dave Wyands cookbook (bt its great :) ) i did came across some camera related stuff and ofc i looked into the rts and advneture tutorials but am kinda out of luck when it comes to solving this.
I looked into the fxGuisnooper resource but my understanding is fairly limited as am no real coder.