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 z_kaiser
Just getting started
Just getting started
 
Posts: 52
Member since: 02.04.2009, 12:17
Likes: 0

Postby z_kaiser » 16.12.2010, 15:47

I have attached an image. I have a cam in front of player and car (it´s what you can see in the panel) and the colors are not normal but are in rigth order :) (ARGB)
User avatar danilochavez
Intern Dev
Intern Dev
 
Posts: 130
Member since: 17.11.2010, 10:35
Location: Guatemala
Likes: 0

Postby danilochavez » 16.12.2010, 15:49

jveer...can you share your code with us?...so we need to apply that viewports too...
E=mc^2
This is more general E^2=(pc)^2+(mc^2)^2
and Me=h*fcompton/c^2 (Me is electron's mass)
User avatar Blue
Junior Dev
Junior Dev
 
Posts: 328
Member since: 18.02.2009, 10:55
Likes: 22

Postby Blue » 16.12.2010, 16:43

@z_kaiser:

If i see it right you dosnt display the texture direct to the screen, am i right? In that case sry - dosnt know how i come up with the idear that you would do it... :unsure: In that case i think its ok - you dont need to transpose the colors.

To the point with the displayed picture:
Ive had some similar problem (but im using dx10), my problem was that i havent used the right rendertag in renderworld. But if you use my way with get rendertype that shouldnt be the problem...
Hm man, thats realy, realy strange you know? Its a little bit of a problem to solve such questions if you dosnt see the code. Ill think about it.

Blue

EDIT: z_kaiser -> try and rotate the decal at 180 degree - the sun shines on it. Ive tryed it on my second pc (xp dx9) and as you see on this pic:
Image


If the decal is in the wrong position, the colors are looking strange.
Last edited by Blue on 16.12.2010, 18:05, edited 1 time in total.
User avatar z_kaiser
Just getting started
Just getting started
 
Posts: 52
Member since: 02.04.2009, 12:17
Likes: 0

Postby z_kaiser » 16.12.2010, 17:36

Oh no, I need a texture on object and then I replace that texture (in the Video Memory) with the data from the FrameBuffer. Now Im trying to improve that image with digital image processing :) to decrease brigthness and increase contrast. I will see... because it causes another frame drop...
User avatar jveer
Just getting started
Just getting started
 
Posts: 13
Member since: 25.10.2010, 22:18
Likes: 0

Postby jveer » 16.12.2010, 18:09

Here the code we use (we use two cameras/rendertargets at the moment):

1st: Define two (or more) rendertargets somewhere (e.g. the initialization):

// Choose the resolution and format as you need/like
int renderTargetLeft = gEnv->pRenderer->CreateRenderTarget(1048, 768, eTF_A8R8G8B8);
int renderTargetRight = gEnv->pRenderer->CreateRenderTarget(1048, 768, eTF_A8R8G8B8);


2nd: In some update function: (we defined two cameras: cameraLeft and cameraRight)

// render right camera:
gEnv->pRenderer->SetCamera(cameraLeft);
gEnv->pRenderer->SetRenderTarget(renderTargetLeft);
gEnv->pRenderer->BeginFrame();
gEnv->p3DEngine->RenderWorld(...); // Render world with the first camera & flags you need
gEnv->pRenderer->EndFrame();
gEnv->pRenderer->SetRenderTarget(0);

// render left camera:
gEnv->pRenderer->SetCamera(cameraRight);
gEnv->pRenderer->SetRenderTarget(renderTargetRight);
gEnv->pRenderer->BeginFrame();
gEnv->p3DEngine->RenderWorld(...); // Render world with the second camera & flags you need
gEnv->pRenderer->EndFrame();
gEnv->pRenderer->SetRenderTarget(0);

3rd: now you have two textures in renderTargetLeft and renderTargetRight which you can use like you want

But still: Everything is a little bit buggy (especially when the two cameras are too far from each other the screen begins to flicker).
User avatar Blue
Junior Dev
Junior Dev
 
Posts: 328
Member since: 18.02.2009, 10:55
Likes: 22

Postby Blue » 16.12.2010, 18:19

Oh no, I need a texture on object and then I replace that texture (in the Video Memory) with the data from the FrameBuffer


Ahm, hm? Sry man my english isnt so good, what are you talking about? Offcourse your object need a texture, but in your screenshoot the decal hat one... or not? O_o

Ive editet my last post and not seen that you postet already, look there, perhaps it can help you.

Blue

PS: Hui a new post, you all are to fast for me... ^^

@jveer:

gEnv->pRenderer->SetRenderTarget(0)

Edit: wrong line ^^

Im such a moron, thx for this. :cheesy: But there is more to thank you, ive found something else what is realy interesting. Ive never thought that the screen is already as a texture in the memory. Ist a little time in the past, ive createt a AviCreateNode - but the framedrop was realy something, but today because of the rendertarets, ive found the screentexture. Think with this my avicreater will be much faster with a lower framedrop, so: realy thanx man!

Blue
Last edited by Blue on 16.12.2010, 18:30, edited 1 time in total.
User avatar z_kaiser
Just getting started
Just getting started
 
Posts: 52
Member since: 02.04.2009, 12:17
Likes: 0

Postby z_kaiser » 16.12.2010, 18:32

Blue you seem to be rigth :) I have to make some tests, I will post results
User avatar jveer
Just getting started
Just getting started
 
Posts: 13
Member since: 25.10.2010, 22:18
Likes: 0

Postby jveer » 16.12.2010, 18:35

yeah you don't leave the graphic-card at all

thats why it's much faster :)
User avatar Blue
Junior Dev
Junior Dev
 
Posts: 328
Member since: 18.02.2009, 10:55
Likes: 22

Postby Blue » 16.12.2010, 18:56

yeah you don't leave the graphic-card at all

thats why it's much faster Smile


Jup - but i see something, perhaps i can help you with:
But still: Everything is a little bit buggy (especially when the two cameras are too far from each other the screen begins to flicker).


:xmas:

gEnv->pRenderer->SetCamera(cameraRight);
gEnv->pRenderer->SetRenderTarget(renderTargetRight);
gEnv->pRenderer->BeginFrame();
gEnv->p3DEngine->RenderWorld(...); // Render world with the second camera & flags you need
gEnv->pRenderer->EndFrame();
gEnv->pRenderer->SetRenderTarget(0);


Do not start a new frame, you are in a update in the current frame! Thats the reason - how do you say, it flicker? Ive only startet with:

gEnv->pSystem->RenderBegin()

before i set the camera and render the world. You also dosnt need RenderEnd() (it works without it in my programm ^^).

Hope it helps - i havent proved it with your system, ive done it with my way there it goes.


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

Postby jveer » 16.12.2010, 19:23

Sadly this doesnt solve our problem :(

The funny thing is that it only flickers when the camera are too far from each other :)

Thus we dont need the cameras far away we don't really care about that problem that much...
User avatar metalparanoia
Just getting started
Just getting started
 
Posts: 50
Member since: 12.04.2009, 08:27
Location: United States
Likes: 0

Postby metalparanoia » 23.12.2010, 05:04

Image[/URL]

wow, you guys are good! it looks like you've actually done it, this forum has been begging for this for forever!

can you please be more specific on how you did this so that other people can get this working?

like, how do you get that render target onto an object? are you guys creating a flowgraph node?

even if there is some flickering problems, i still would like to try this myself
(it would be nice if someone posted full source code...)

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

Postby DURLI » 04.01.2011, 00:21

hi guys, thanks for answering my topic, maybe we should put our codes together and make it aviable for public , cant wait for dynamic zoom.
Image
C++ || C# || 3D Artist || 2D Artist || UI Artist || Animator
User avatar danilochavez
Intern Dev
Intern Dev
 
Posts: 130
Member since: 17.11.2010, 10:35
Location: Guatemala
Likes: 0

Postby danilochavez » 04.01.2011, 10:18

yes, dynamic zoom will be great...share your codes.....
E=mc^2
This is more general E^2=(pc)^2+(mc^2)^2
and Me=h*fcompton/c^2 (Me is electron's mass)
User avatar Blue
Junior Dev
Junior Dev
 
Posts: 328
Member since: 18.02.2009, 10:55
Likes: 22

Postby Blue » 04.01.2011, 16:57

I have a good and a bad message.

The good message, ill create two small FlowNodes for the FlowgraphPluginSystem because of the many requests in this thread. One to display a cam direct to the screen. The nother one will link a cam to a texture.

BUT -> THIS WILL DROP YOU FRAMERATE!
(So dont blame me if your mod work realy slow ^_^ )

The bad message, the new nodes wont come before the end of the month because a lack of time.


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

Postby DURLI » 04.01.2011, 18:01

if you are busy atm , if you send me code (pm) I can easily make flownodes , with your credits of course
Image
C++ || C# || 3D Artist || 2D Artist || UI Artist || Animator