Forums Gallery LOGIN |REGISTER

Community Archive is read-only - Here you can view content recorded up until February 2017. To join the latest discussions visit our new forums


New Viewport + RENDER TO TEXTURE

Please use this forum for questions on C++, Lua, XML, and any other languages used in Crysis modding.


 

User avatar DURLI
Regular Dev
Regular Dev
 
Posts: 545
Images: 2
Member since: 21.10.2009, 19:52
Location: Slovakia, EU
Likes: 6

New Viewport + RENDER TO TEXTURE

Postby DURLI » 22.11.2010, 16:06

Does anybody knows how to create new viewport like with r_ShowRenderTarget ?
IViewSystem is abstract class so it cannot be instantiated.
Thanks
Image
C++ || C# || 3D Artist || 2D Artist || UI Artist || Animator
User avatar jveer
Just getting started
Just getting started
 
Posts: 13
Member since: 25.10.2010, 22:18
Likes: 0

Postby jveer » 07.12.2010, 13:20

I'm very interested in this too!

Can anyone give an answer or a hint how to realise two different viewports on the screen?
User avatar Ulysses182
Producer
Producer
 
Posts: 1228
Member since: 31.10.2008, 17:38
Location: Croatia
Likes: 3

Postby Ulysses182 » 07.12.2010, 19:15

You can have up to four viewports on the screen. (All four can be different perspective viewports)
Right click on "Perspective" 1 cm under "File", then "Configure Layout", then choose one. For each new view, you can make it "Top", "Front", "Left", "Perspective" etc... by clicking "View" above the "Configure Layout"

However, having more perspective views, causes some render errors.
For example, if a viewport gets blurred set r_motionblur to 4.


I hope that's what you meant.
Image Video
Image DOWNLOAD
User avatar jveer
Just getting started
Just getting started
 
Posts: 13
Member since: 25.10.2010, 22:18
Likes: 0

Postby jveer » 08.12.2010, 18:10

Thanks for your reply.

Sadly that's not what I meant :)

I don't want a new viewport in the Sandbox editor.

More a split-screen in the "real" game. BUT without using predefined procedures (I made my own cameras in the sourcecode and i want to show one in an extra viewport).

I am able to change the viewport somehow, but the engine always sets it back ;)
(if I change it every frame the framerate drops below 1)

As DURLI mentioned I want it like its shown with the command r_ShowRenderTarget
User avatar Ulysses182
Producer
Producer
 
Posts: 1228
Member since: 31.10.2008, 17:38
Location: Croatia
Likes: 3

Postby Ulysses182 » 08.12.2010, 19:08

Oh, I'm sorry.
Something likethis,then?
James-Ryan made it. Now known as Cry-JR.
Try to ask him.


If that's not it, then I give up. :)
Image Video
Image DOWNLOAD
User avatar Yaxxo
Producer
Producer
 
Posts: 1764
Member since: 08.03.2010, 17:18
Location: Netherlands(NL)
Likes: 6

Postby Yaxxo » 08.12.2010, 19:48

Originally posted by Ulysses182
Oh, I'm sorry.
Something likethis,then?
James-Ryan made it. Now known as Cry-JR.
Try to ask him.


If that's not it, then I give up. :)

The multiple viewport video is like the crysis holy grail, and Cry-JR is the keeper of it. And i have heard why it was never released, it's quite understandable.
[22:58] <Leon35> even more proof that D_wolf cant argue
[22:58] <Leon35> he almost always redirects points to personal insults
[22:58] <D_wolf> says the pothead
User avatar Mr.Hankey
Regular Dev
Regular Dev
 
Posts: 476
Member since: 06.11.2007, 20:41
Location: Germany
Likes: 0

Postby Mr.Hankey » 08.12.2010, 23:33

So don't you want to share your knowledge and name the reason why it wasn't ever released?
User avatar Jonzki1
Skilled Developer
Skilled Developer
 
Posts: 662
Member since: 11.07.2008, 12:34
Location: Finland
Likes: 0

Postby Jonzki1 » 08.12.2010, 23:47

Well, James-Ryan never really told us why it wasn't released, so the community pretty much presumed it was a feature for some superior mod or something... It's a mystery ;)
If there's an exception to every rule, there must be an exception to the rule that there's an exception to every rule. How about that?
User avatar Yaxxo
Producer
Producer
 
Posts: 1764
Member since: 08.03.2010, 17:18
Location: Netherlands(NL)
Likes: 6

Postby Yaxxo » 09.12.2010, 00:10

I only heard it on the IRC, and it had something to do with crytek iirc, but for the complete and correct story, you really should ask him.
[22:58] <Leon35> even more proof that D_wolf cant argue
[22:58] <Leon35> he almost always redirects points to personal insults
[22:58] <D_wolf> says the pothead
User avatar jveer
Just getting started
Just getting started
 
Posts: 13
Member since: 25.10.2010, 22:18
Likes: 0

Postby jveer » 09.12.2010, 13:21

Originally posted by Ulysses182
Oh, I'm sorry.
Something likethis,then?
James-Ryan made it. Now known as Cry-JR.
Try to ask him.


If that's not it, then I give up. :)


That's exactly what I'm looking for :)

sad he never revealed the code ;(
User avatar Blue
Junior Dev
Junior Dev
 
Posts: 328
Member since: 18.02.2009, 10:55
Likes: 22

Postby Blue » 09.12.2010, 23:56

Hm, perhaps im wrong, but r_ShowRenderTarget only shows what you already can see, or not? That is realy easy to accomplish, but to get more viewports its like in sb2 - killer framedrop! You can create more ViewPorts if you render the scenes per frame for each used camera, but the freamedrop will kill you. ^^

Ive tryed and stoped it after two weeks, because i think the way wasnt right. There must be better way to do it. With 5 Viewport (4 to see - one lost), my system was at his end. Ok you can use the viewports as textures so that you can use it so much as you whant. But there is no use to it if your framerate is 4-6fps. -_-

Here is a little video who i made (because i asked something.... but there was no answer... :( ). It will show you what i mean. Ah and yes, you also can project it to your screen, but the framedrop will also be realy hevy - so there isnt much difference. :meow:

[YOUTUBE]A7dDB140Jks[/YOUTUBE]



Sry, for my bad english,

Blue
User avatar jveer
Just getting started
Just getting started
 
Posts: 13
Member since: 25.10.2010, 22:18
Likes: 0

Postby jveer » 10.12.2010, 00:50

Thus we only need 2 viewports at all and our machines in the university are up to date I don't really care THAT much about the framerate.

Would you be so kind to give me a part of your sourcecode or at least a hint how to realise a second viewport (we are really stucked at this point at the moment).

We tried the ChangeViewport method of the pRender but the Engine always change it back to the normal view (same thing if we want to change the resolution). All other methods/adjustments didn't even show a change in the viewport at all :(

Best regards,

Jannis.
User avatar Blue
Junior Dev
Junior Dev
 
Posts: 328
Member since: 18.02.2009, 10:55
Likes: 22

Postby Blue » 10.12.2010, 01:16

Hm k, so as i say, you must render each viewport.

Hm, i can take tomorow a look in my sourcecode if you want. If i remember correct, ive done this:

created a flownode
defined some cameras
int the update:
- saved current cam
- changed viewport to new cam
- unhide upper body of the player
- render new scene
- grab the framebuffer
-- version 1:
-- upload in videobuffer
-- draw in hudupdate texture as image on the screen
-- version 2:
-- readframebuffer fast, dump texture, reload texture
...
after repeating this 3 times
...
- hide upper body
- set back to old cam
- render old cam

finish. :cheesy:


The problem is that this way isnt goodd. Think there is a way over the shaders, but i wasnt interested in this so much, so ive given up. :whistle:


Blue
User avatar jveer
Just getting started
Just getting started
 
Posts: 13
Member since: 25.10.2010, 22:18
Likes: 0

Postby jveer » 10.12.2010, 03:27

Your solutions sounds very interesting - didn't thought about that :)

I'll try it out tomorrow by myself :))

of course a part of the sourcecode would be awesome :cheesy:
User avatar Blue
Junior Dev
Junior Dev
 
Posts: 328
Member since: 18.02.2009, 10:55
Likes: 22

Postby Blue » 10.12.2010, 18:52

K - i looked in my source code. Dosnt think you need all of it, so i decided to pick out some lines who hold the "important" parts.

Code: Select all
camOrigin = gEnv->pSystem->GetViewCamera(); //first save the curren camera
gEnv->pSystem->RenderBegin(); //let the framework know that it will start with the rendering
pRenderer->SetCamera(camViewport[0]); //set a new cam
gEnv->p3DEngine->RenderWorld(pRenderer->GetRenderType(), pRenderer->GetCamera(), "cam_try1", -1, FILTER_LINEAR ); //render the world to the framebuffer
pRenderer->ReadFrameBufferFast(uTexSource[0],  iWidth, iHeight); //read the framebuffer
pRenderer->SetCamera(camOrigin); //dosnt know if its nexessary - for some reason ive deactivated it... the code is full of changes because of try and error ^^
gEnv->pSystem->RenderBegin(); //let the framework know that it can do what it want to do ^^


After this you can do what you want with the picture information in uTexSource. Render it to the screen or dump it in a file. ;)


Blue


cron