1 registered members (AndrewAMD),
1,244
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: How was this Game Rendered?
[Re: Dooley]
#481156
08/07/20 19:02
08/07/20 19:02
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
@Emre I'm also getting 8 fps. As I know all 'draw_' functions are extremely slow (manual disagrees, but they were always slow from my experience)... Probably the way those functions are working in on acknex side has something to do with AMD GPUs... Edit: take a look at the particles ms/frame... it's around ~100ms... damn
Last edited by 3run; 08/07/20 19:05.
|
|
|
Re: How was this Game Rendered?
[Re: Quad]
#481160
08/08/20 00:34
08/08/20 00:34
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
@Emre that's 180-200 fps here. Wow! It seems jcl has developed a "Line tracing" or" DLSL" (Deep learning super lines) technique that only works for Nvidia rtx cards. @3run seems the manual tell the half of the truth. They forgot to add; " For the best experience, requires an Nvidia branded card supporting DLSL technology." Edit: Last verison runs fine. (300 fps)
Last edited by Emre; 08/09/20 15:23.
|
|
|
Re: How was this Game Rendered?
[Re: Dooley]
#481162
08/08/20 09:54
08/08/20 09:54
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
Okay, that works better. Let's see what Emre and 3run are experiencing.
The effect kind of looks a diminished a little bit. It's still a very cool effect but maybe you could bring the near cutoff range closer to camera?
3333333333
|
|
|
Re: How was this Game Rendered?
[Re: Emre]
#481163
08/08/20 13:27
08/08/20 13:27
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
@3run seems the manual tell the half of the truth. They forgot to add; " For the best experience, requires an Nvidia branded card supporting DLSL technology." Demo seems to run perfectly fine now. I get around 500 fps with normal resolution (drops down to ~200 when tentacles are near by). In normal resolution effect reminds me somehow of the spider webs, looks nice man! When pixelated, it looks like white noise, but only green in color.
|
|
|
Re: How was this Game Rendered?
[Re: Dooley]
#481842
11/08/20 01:27
11/08/20 01:27
|
Joined: May 2005
Posts: 868 Chicago, IL
Dooley
OP
User
|
OP
User
Joined: May 2005
Posts: 868
Chicago, IL
|
Hey, I have a follow up question on this. My other game Paradox Vector seems to be experiencing the same issue with AMD cards. I am looking into possible ways to remedy this. Right now i am using draw_line3d to render lines. The wireframe material also works, and is faster, but it ends up looking very bad because of some of it's limitations. In lite-c, the wireframe shader seems to come down to these lines: MATERIAL* mtl_wireframe =
{
effect = "technique { pass { Fillmode = Wireframe; } }";
event = mtl_model_init;
} This seems to be something built right into the engine itself, because I cannot find any "wireframe.fx" file that defines how it works. Is there any way to write a shader (.fx file) that would draw the lines based on the same parameters as my script? And if so, do you think it might help resolve the problem? I plan to try messing around with a shader script to see what I can come up with, but if anyone has any ideas, that would be great! My existing script is as follows, and it is being called in the EVENT_FRAME for most objects: function draw_me(var my_blue, var my_green, var my_red, var my_alpha, var start_vec)
{
VECTOR line_pos;
var line_x = 0;// = start_vec;
var vert_num = ent_status(my,1);
for(line_x = start_vec;line_x < vert_num;line_x++)
{
vec_for_vertex(line_pos,my,line_x);
if(line_x == start_vec)
{
draw_line3d(line_pos.x,NULL,my_alpha);
draw_line3d(line_pos.x,vector(my_blue,my_green,my_red),my_alpha);
}
else if(line_x == vert_num)
{
vec_for_vertex(line_pos,my,start_vec);
draw_line3d(line_pos.x,vector(my_blue,my_green,my_red),my_alpha);
}
else
{
draw_line3d(line_pos.x,vector(my_blue,my_green,my_red),my_alpha);
}
}
} Each model will provide its own colors, as will as starting vector when it calls this script - the script uses floating vectors (not attached to any triangle faces in the models) to draw the lines above the black surface faces of each model. Alpha is determined by the model's distance from the camera, as fog does not seem to work on 3d lines.
|
|
|
Re: How was this Game Rendered?
[Re: Dooley]
#481845
11/08/20 14:33
11/08/20 14:33
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hey! draw_line, etc functions are using particles, and since particles are 2d they aren't affected by light or fog. FillMode = Wireframe is something related to the HLSL, you can google that in Microsoft directx documentation. I played around a little bit and got these results: It supports: - hard edges - edge darken on angle - no dynamic lights (can be added) - alpha control for wireframe - fog To my taste, it lacks the ability to control the thickness of the wireframes... Maybe some other more experienced users may tweak it or provide their own solution. Code: main.c
#define PRAGMA_POINTER
MATERIAL *mtl_wireframe =
{
effect = "wireframe.fx";
flags = AUTORELOAD;
}
void main()
{
warn_level = 6;
fps_max = 60;
level_load("");
ENTITY *ent = ent_create("ball.mdl", vector(64, 0, 0), NULL);
ent->material = mtl_wireframe;
vec_set(&ent->blue, COLOR_GREY); // you can change color for each model by hand
// material settings with range (0..1)
ent->skill41 = floatv(1); // red
ent->skill42 = floatv(1); // green
ent->skill43 = floatv(1); // blue
ent->skill44 = floatv(0.1); // alpha
} wireframe.fx
// set to zero to disable effect
#define ANGLE_SURFACE_DARKEN 0.25 // less number - less darken
float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecViewPos;
float4 vecFog;
float4 vecFogColor;
float4 vecLight;
float4 vecColor;
float4 vecSkill41; // used to controll wireframe color
texture entSkin1;
sampler ColorSampler = sampler_state
{
Texture = <entSkin1>;
Mipfilter = None;
Minfilter = None;
Magfilter = None;
};
void VS(
in float4 inposition : POSITION,
in float3 innormal : NORMAL,
in float4 intex1 : TEXCOORD0,
in float4 intex2 : TEXCOORD1,
out float4 outposition : POSITION,
out float4 outcolor : COLOR0,
out float3 outnormal : TEXCOORD0,
out float4 outtex : TEXCOORD1,
out float4 outworldPos : TEXCOORD2)
{
inposition.w = 1.0f;
outposition = mul(inposition, matWorldViewProj);
outnormal = normalize(mul(innormal, (float3x3)matWorld));
outtex.xy = intex1.xy;
outtex.zw = intex2.xy;
outworldPos = mul(inposition, matWorld);
// no lightning
outcolor = float4(vecColor.xyz, vecLight.w);
}
float4 PS(
float4 color : COLOR0,
float3 normal : TEXCOORD0,
float4 tex : TEXCOORD1,
float4 worldPos : TEXCOORD2) : COLOR0
{
// hard edges (if needed)
float3 dpdx = ddx(worldPos);
float3 dpdy = ddy(worldPos);
normal.xyz = normalize(cross(dpdy, dpdx));
float4 textureColor = tex2D(ColorSampler, tex.xy);
// darken surface on angle
if(ANGLE_SURFACE_DARKEN > 0)
{
float3 vPixelToViewDir = normalize(vecViewPos.xyz - worldPos.xyz); // *** direction vector from the surface to the camera
float dot_result = dot(vPixelToViewDir, normal.xyz); // *** get the angle ( cos(angle) ) between these vectors; both vectors in the dot product have to be normalized (length = 1)
color.rgb *= saturate(1.0 - (1.0 - dot_result) * ANGLE_SURFACE_DARKEN); // *** apply the darkening factor with adjustable intensity; saturate() to prevent negative numbers (and numbers > 1)
}
// add texture to the color
color.rgb *= textureColor.rgb;
// fog part
// just remove this 3 lines to remove the fog
float fDepth = distance ( vecViewPos.xyz, worldPos.xyz );
float Fog = saturate ( ( fDepth - vecFog.x ) * vecFog.z );
color.rgb = lerp ( color.rgb, vecFogColor, Fog );
color.a = 1;
return color;
}
void WR_VS(
in float4 inposition : POSITION,
out float4 outposition : POSITION)
{
// dirty trick to draw wiraframes
// above the actual solid polygons
inposition.w = 0.998f;
outposition = mul(inposition, matWorldViewProj);
}
float4 WR_PS(
float4 color : COLOR0,
float4 worldPos : TEXCOORD2) : COLOR0
{
// change wireframe color with vecSkill41...43
color.rgb = vecSkill41.xyz;
// fog for wireframes
// just remove this 3 lines to remove the fog
float fDepth = distance ( vecViewPos.xyz, worldPos.xyz );
float Fog = saturate ( ( fDepth - vecFog.x ) * vecFog.z );
color.rgb = lerp ( color.rgb, vecFogColor, Fog );
color.a = vecSkill41.w; // alpha value of the wireframe
return color;
}
technique
{
pass pass0 // first draw the solid model with hard edges
{
ZWriteEnable = True;
AlphaBlendEnable = False;
AlphaTestEnable = False;
AlphaFunc = ALWAYS;
Fillmode = SOLID;
VertexShader = compile vs_3_0 VS();
PixelShader = compile ps_3_0 PS();
}
pass pass1 // then draw wireframes
{
ZWriteEnable = True;
AlphaBlendEnable = True;
AlphaTestEnable = False;
AlphaFunc = Greater;
Fillmode = Wireframe;
VertexShader = compile vs_2_0 WR_VS();
PixelShader = compile ps_2_0 WR_PS();
}
}
technique fallback { pass one { } } ball.mdl is the one from "GStudio8\templates\models" folder. Model's color is controller directly by ent->blue, green, red values. Wireframe color is controlled by ent->skill41, 42, 43 (red, green, blue) Greets.
Last edited by 3run; 11/10/20 15:54. Reason: added alpha support for wireframes
|
|
|
|