3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Grafton
OP
User
|
OP
User
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.
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: jcl]
#299756
11/26/09 17:01
11/26/09 17:01
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
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).
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!
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);
}
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: jcl]
#299864
11/27/09 18:24
11/27/09 18:24
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
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: Petra]
#299892
11/27/09 21:59
11/27/09 21:59
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
Joined: Jun 2005
Posts: 656
|
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". I think that's what all the people tried to tell you,
Huh? All what people? Perhaps there is some miscommunication. 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. 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: Spirit]
#299950
11/28/09 13:30
11/28/09 13:30
|
Joined: Jun 2005
Posts: 656
Grafton
OP
User
|
OP
User
Joined: Jun 2005
Posts: 656
|
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. 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. 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.
|
|
|
|