Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,643 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Enable post processing for view entities [Re: jcl] #299684
11/26/09 02:00
11/26/09 02:00
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Hmm... did you uncomment the two lines in the example creating the "camera.bmap" as I indicated in my post?
Sorry, sometimes I am not so clear in my communication.

In this stand alone example below, the view entity is erroneously not visible because a rendertarget is assigned to the camera view, even though the rendertarget is not used, just assigned. Also it seems to make no difference to which view the entity is assigned. If you comment out the line "camera.bmap = camera_scene;", the view entity becomes visible.

Code:
BMAP* camera_scene;
VIEW* SecondView = {flags = PROCESS_TARGET;}

ENTITY* blob =
{
  type = "blob.mdl";
  flags2 = SHOW;  
  x = 150; 
  y = 35; 
}
 
function main()
{
  camera_scene = bmap_createblack(screen_size.x, screen_size.y,32);
  camera.bmap = camera_scene; // This prevents view entity visibility, comment out to test

  camera.stage = SecondView;
  level_load("");
  ent_create("blob.mdl",vector(150,0,0),NULL);
}



If I am not understanding, could you please post a simple two stage PP example (like above), that has a camera.bmap assigned and a visible view entity?

Thanks JCL.


Not two, not one.
Re: Enable post processing for view entities [Re: Grafton] #299704
11/26/09 08:45
11/26/09 08:45
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Of course you don't see an entity on the screen when you render it into a bitmap instead.

http://manual.3dgamestudio.net/aview-bmap.htm

It makes only sense to give a view entity a render target when you want to view it in a panel or something like that. Otherwise, just render it straight on the screen.


Re: Enable post processing for view entities [Re: jcl] #299756
11/26/09 17:01
11/26/09 17:01
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Thanks for your patience JCL.

When the view.bmap is used in a panel, the view entity is indeed visible. However if the view.bmap is used as a skin in a view material for an PP effect, it is not.

This sample illustrates the problem myself and the others are having. Here I render the view with the view entity to a bitmap and pass the bitmap to the second view material as skin1. All the effect does is return skin1 to the screen. I expect the original view with the view entity to be displayed (two blobs), however the view entity is not visible (only one blob).


Code:
BMAP* camera_scene = "#1024x768x32";

ENTITY* blob = { type = "blob.mdl";  flags2 = SHOW; x = 150; y = 35; }

MATERIAL* mtl_ShowRt = 
{	
  skin1 = camera_scene;

  effect = "
  Texture mtlSkin1; 
  sampler OrgSampler = sampler_state { texture = <mtlSkin1>;};

  float4 main_PS(float2 Tex: TEXCOORD0) : COLOR  { return tex2D(OrgSampler, Tex); }

  technique one { pass P1 { PixelShader = compile ps_2_0 main_PS(); } }";
}

VIEW* SecondView = { material = mtl_ShowRt; flags = PROCESS_TARGET;}

function main()
{
  video_set(1024,768,0,1); 
  camera.bmap = camera_scene; 
  camera.stage = SecondView;
  level_load("");
  ent_create("blob.mdl",vector(150,0,0),NULL);
}



In the above example, if I use a predefined bitmap for skin1 (such as "logo_800.jpg" from the GS folder), it is rendered to the screen as expected, however if I use the view.bmap, the view.bmap is not rendered to the screen.

This example is the same as above, except the view.bmp is rendered in a panel, correctly. Since the effect only renders the view.bmap to the screen, the screen should be a duplicate of the panels bitmap, but it is not!

Code:
BMAP* camera_scene = "#1024x768x32";

ENTITY* blob = { type = "blob.mdl";  flags2 = SHOW; x = 150; y = 35; }

PANEL * RT_Panel = {pos_x = 0; pos_y = 0; scale_x = 0.25; scale_y = 0.25; flags = SHOW;}

MATERIAL* mtl_ShowRt = 
{	
  skin1 = camera_scene;

  effect = "
  Texture mtlSkin1; 
  sampler OrgSampler = sampler_state { texture = <mtlSkin1>;};

  float4 main_PS(float2 Tex: TEXCOORD0) : COLOR  { return tex2D(OrgSampler, Tex); }

  technique one { pass P1 { PixelShader = compile ps_2_0 main_PS(); } }";
}

VIEW* SecondView = { material = mtl_ShowRt; flags = PROCESS_TARGET;}

function main()
{
  video_set(1024,768,0,1); 
  camera.bmap = camera_scene; 
  RT_Panel.bmap = camera_scene;
  camera.stage = SecondView;
  level_load("");
  ent_create("blob.mdl",vector(150,0,0),NULL);
}



Quote:

It makes only sense to give a view entity a render target when you want to view it in a panel or something like that. Otherwise, just render it straight on the screen.


Simple example; say I have weapon as a view entity, and I have a PP view chain (which passes the original view to the effect chain for blending). I want the PP effects to include the weapon or at least for the weapon to be visible. This does not seem possible.

If I (and the others) can not do this, then beginners will never "get it" either. If it is possible, then please provide an example.

Thanks.


Not two, not one.
Re: Enable post processing for view entities [Re: Grafton] #299808
11/27/09 08:53
11/27/09 08:53
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Hmm, I don't think that it's so difficult to "get" it. At least, many people use PP and view entities and we've never heard that anyone had problems with them.

But I'll do my best to make this issue more clear in the manual. You only need to understand one simple thing: view entities are totally unaffected by PP effects. They are rendered after all the views. Thus they just look plain on the screen. You can not use them for a view material simply because they are not yet rendered at the time when the views are processed.

If you want PP effects for a weapon, the obvious solution is to use a normal level entity and move it with the camera. It's just the same when you want other level effects like dynamic lights, fog, etc for your weapon - all this is not available for view entities. I think this is just sort of logical.

Re: Enable post processing for view entities [Re: jcl] #299864
11/27/09 18:24
11/27/09 18:24
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
The weapon senerio is only one. For example, I can not have quality DOF or Bloom applied to "sun flares" (view ents) unless the flare sprites are level entities? I dont think that is workable. I will have to choose between the two.

It seems that view entities are rendered in the first (camera) view. So that view cannot have a RT or the view ents will not be visible at all. Also, view ents can not be rendered to an RT for use elsewhere and also be visible on the screen. This makes post processing them tough.

The purpose of my post was to request a solution for view entity PP, or a working example if its possible, and I have, I'm done.

Thanks.





Not two, not one.
Re: Enable post processing for view entities [Re: Grafton] #299867
11/27/09 18:55
11/27/09 18:55
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
Hmm, why do you render all the time your view entities into a bitmap instead of just on the screen? I think that's what all the people tried to tell you, you just must not render them with a render target view when you want them visible.

I am using Shade-C and have many view entities for a compass and other elements, never had a problem with them. I just render them with a normal view.

Re: Enable post processing for view entities [Re: Petra] #299892
11/27/09 21:59
11/27/09 21:59
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Originally Posted By: Petra
Hmm, why do you render all the time your view entities into a bitmap instead of just on the screen?


I do not. The examples I provide do. This thread is about post processing view entities, thus the title; "Enable post processing for view entities".

Originally Posted By: Petra

I think that's what all the people tried to tell you,

Huh? All what people? Perhaps there is some miscommunication.

Originally Posted By: Petra

you just must not render them with a render target view when you want them visible.


Then you can not post process the view entities to match the view, which again, is the subject of this thread, and the basis of my request.

Originally Posted By: Petra

I am using Shade-C and have many view entities for a compass and other elements, never had a problem with them. I just render them with a normal view.


If you are using shade-c and have visible view entities, then you are not using shade-c's PP. Shade-c's PP effects are set up to render the camera.view to a rendertarget exactly like the examples above, so you must either rewrite shade-c to use an additional, later view to supply this target, or in some way assign the view ent to a different view that does not use a rendertarget (not currently possible?), just to get the view ent visible. Neither of these solve the problem of post processing the view ent as part of the scene.

My request is simply to be able to choose via a flag, to postprocess a view ent with the rest of the scene or not.

Apologies if my post seems somewhat short, but I am weary of this topic.

Thanks for your interest.














Not two, not one.
Re: Enable post processing for view entities [Re: Grafton] #299900
11/27/09 22:48
11/27/09 22:48
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
The obvious solution is to grab the frame buffer after all rendering (besides panels) and then do post processing.

I dont know why the engine isn't set up like this.


Sphere Engine--the premier A6 graphics plugin.
Re: Enable post processing for view entities [Re: Grafton] #299925
11/28/09 06:30
11/28/09 06:30
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Matt, I think this would not be good, you often need different postprocessing in different views. That would not work with postprocessing the whole frame buffer. Its better to postprocess views separately.

Grafton, Petra is right, your invisible view ent was just a clear mistake in your code. Thats what people tried to tell you all the time, you still seem not to understand.

You must not render them into the camera target bmap. You must render them with a normal view on the screen. Thats just missing in your code. When you dont assign a normal view, the entity uses the camera view by default and then you cant see it because of your code. Its this simple, no new engine feature required here.

I have lens flares together with a HDR shader that I took from a shader lib, I believe it was shade-C. Its using many render targets and I also never had a problem with my view ents.

Re: Enable post processing for view entities [Re: Spirit] #299950
11/28/09 13:30
11/28/09 13:30
Joined: Jun 2005
Posts: 656
G
Grafton Offline OP
User
Grafton  Offline OP
User
G

Joined: Jun 2005
Posts: 656
Originally Posted By: Spirit

Grafton, Petra is right, your invisible view ent was just a clear mistake in your code. Thats what people tried to tell you all the time, you still seem not to understand.


Are you and Petra the same person? All what people? Who are you talking about? Other than Petra, the others in this thread support my request. There is no mistake. I know the posted code does not work, thats why I posted it, to illustrate it does not. I would like it to work, thus my request to enable PP for view ents. I want postprocessing to affect view ents if i choose. This can be done if the view ents can be both visible and renderable to a target map.

Originally Posted By: Spirit

You must not render them into the camera target bmap. You must render them with a normal view on the screen. Thats just missing in your code. When you dont assign a normal view, the entity uses the camera view by default and then you cant see it because of your code. Its this simple, no new engine feature required here.


My request is to simply to be able to choose via a flag, to postprocess a view ent with the rest of the scene or not.
You currently can not do this, ergo the feature request.

Originally Posted By: Spirit

I have lens flares together with a HDR shader that I took from a shader lib, I believe it was shade-C. Its using many render targets and I also never had a problem with my view ents.


As even stated by the developer, Shade-c does not render view ents visibly. I even explained why. It sounds as if you just have visible view entities and stripped some fx code from shade-c, please explain how you are post processing the view entities so the effect is shared on them as it would be a level entity that uses a RTT in its effect chain? That is the topic of this thread and the crux of my request.

Thanks for your interest.







Not two, not one.
Page 2 of 3 1 2 3

Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1