[求助]关于即时光影
我们知道,现在大部分3D引擎支持动态光影HDR,法线贴图,滤镜效果......画面越来越好.
但是我看到GS开发的画面一般都很差,没有阴影,没有光感,体积感,棱角分明....
虽然利用烘培贴图可以让画面好一些,
甚至可以把阴影,高光等等烘培到所有物体的贴图里面,但是我很想知道,
GS引擎方面,能做到什么样子的即时效果呢? 也就是即时渲染能力,
画面全靠贴图的话,感觉跟网游差不多,人物飘飘的,感觉不好 動態陰影當然有啦。
使用各種fx腳本,各種shader的效果基本上都做得到。
單看遊戲截圖來評估一個引擎的功能是不可以作準的。 自己写Shader吧= =
不过话说模板阴影之类的貌似需要引擎支持吧= v = 引用第2楼ultranet于2008-01-01 12:36发表的:
動態陰影當然有啦。
使用各種fx腳本,各種shader的效果基本上都做得到。
單看遊戲截圖來評估一個引擎的功能是不可以作準的。
的确没有见到比较好的游戏画面,所以才有这个疑问,
我不是程序员,不太了解引擎的架构. static const float AmbientIntensity = 1.0f; // The intensity of the ambient light.
static const float DiffuseIntensity = 1.0f; // The intensity of the diffuse light.
static const float4 SunColor = {0.9f, 0.9f, 0.5f, 1.0f}; // Color vector of the sunlight.
// Application fed data:
const float4x4 matWorldViewProj; // World*view*projection matrix.
const float4x4 matWorld; // World matrix.
const float4 vecAmbient; // Ambient color, passed by the engine.
const float4 vecSunDir; // The sun direction vector.
texture entSkin1; // Color map.
sampler ColorMapSampler = sampler_state // Color map sampler.
{
Texture = <entSkin1>;
AddressU= Clamp;
AddressV= Clamp;
};
/***********************************************************************************************
/ Vertex Shader:
/***********************************************************************************************/
void DiffuseVS( in float4 InPos : POSITION,
in float3 InNormal : NORMAL,
in float2 InTex : TEXCOORD0,
out float4 OutPos : POSITION,
out float2 OutTex : TEXCOORD0,
out float3 OutNormal: TEXCOORD1)
{
// Transform the vertex from object space to clip space:
OutPos = mul(InPos, matWorldViewProj);
// Transform the normal from object space to world space:
OutNormal = normalize(mul(InNormal,matWorld));
// Pass the texture coordinate to the pixel shader:
OutTex = InTex;
}
/***********************************************************************************************
/ Pixel Shader:
/***********************************************************************************************/
float4 DiffusePS( in float2 InTex : TEXCOORD0,
in float3 InNormal : TEXCOORD1) : COLOR
{
// Calculate the ambient term:
float4 Ambient = AmbientIntensity * vecAmbient;
// Calculate the diffuse term:
float4 Diffuse = DiffuseIntensity * saturate(dot(vecSunDir, normalize(InNormal)));
Diffuse *= SunColor;
// Fetch the pixel color from the color map:
float4 Color = tex2D(ColorMapSampler, InTex);
// Calculate final color:
return (Ambient + Diffuse) * Color;
}
/***********************************************************************************************
/ Technique:
/***********************************************************************************************/
technique DiffuseTechnique
{
pass P0
{
VertexShader = compile vs_2_0 DiffuseVS();
PixelShader= compile ps_2_0 DiffusePS();
}
}
////////////////////
存为.FX 在wdl内又加:
material Diffuse
{
ambient_red = 50;
ambient_green = 50;
ambient_blue = 50;
effect = "123.fx";
}
action abc
{
my.material = Diffuse
}
//////////////////////////////////
不知道为什么这个脚本好像用不了,使那个图变成一个颜色 引用第3楼Miliardo于2008-01-01 12:44发表的:
自己写Shader吧= =
不过话说模板阴影之类的貌似需要引擎支持吧= v =
你来帮我写吧!!! 其實動態光影的設置非常簡單,
首先在main函數設shadow_stencil=ON;
然後在entity的action設set(my,SHADOW);
這樣entity就會被太陽光或其他發光體照射而產生動態陰影。 那样的话还不如在 wed直接设置……只是很难看。问题我解决了,搞一个太阳就可以了
页:
[1]
2