守望先鋒是如何做到讓PBR渲染較為相容低配置環境的?

時間 2021-05-11 23:58:27

1樓:

直觀來看,計算量沒大乙個數量級

float4 PS(VertexOut pin) : SV_Target

// Fetch the material data.

MaterialData matData = gMaterialData[gMaterialIndex];

float4 diffuseAlbedo = matData.DiffuseAlbedo;

float3 fresnelR0 = matData.FresnelR0;

float roughness = matData.Roughness;

uint diffuseMapIndex = matData.DiffuseMapIndex;

uint normalMapIndex = matData.NormalMapIndex;

// Dynamically look up the texture in the array.

diffuseAlbedo *= gTextureMaps[diffuseMapIndex].Sample(gsamAnisotropicWrap, pin.TexC);

#ifdef ALPHA_TEST

// Discard pixel if texture alpha < 0.1. We do this test as soon

// as possible in the shader so that we can potentially exit the

// shader early, thereby skipping the rest of the shader code.

clip(diffuseAlbedo.a - 0.1f);

#endif

// Interpolating normal can unnormalize it, so renormalize it.

pin.NormalW = normalize(pin.NormalW);

float4 normalMapSample = gTextureMaps[normalMapIndex].Sample(gsamAnisotropicWrap, pin.TexC);

float3 bumpedNormalW = NormalSampleToWorldSpace(normalMapSample.rgb, pin.NormalW, pin.

TangentW);

//bumpedNormalW = pin.NormalW;

// Vector from point being lit to eye.

float3 toEyeW = normalize(gEyePosW - pin.PosW);

// Finish texture projection and sample SSAO map.

pin.SsaoPosH /= pin.SsaoPosH.w;

float ambientAccess = gSsaoMap.Sample(gsamLinearClamp, pin.SsaoPosH.xy, 0.0f).r;

// Light terms.

float4 ambient = ambientAccess*gAmbientLight*diffuseAlbedo;

// Only the first light casts a shadow.

float3 shadowFactor = float3(1.0f, 1.0f, 1.0f);

shadowFactor[0] = CalcShadowFactor(pin.ShadowPosH);

const float shininess = (1.0f - roughness) * normalMapSample.a;

Material mat = ;

float4 directLight = ComputeLighting(gLights, mat, pin.PosW,

bumpedNormalW, toEyeW, shadowFactor);

float4 litColor = ambient + directLight;

// Add in specular reflections.

float3 r = reflect(-toEyeW, bumpedNormalW);

float4 reflectionColor = gCubeMap.Sample(gsamLinearWrap, r);

float3 fresnelFactor = SchlickFresnel(fresnelR0, bumpedNormalW, r);

litColor.rgb += shininess * fresnelFactor * reflectionColor.rgb;

// Common convention to take alpha from diffuse albedo.

litColor.a = diffuseAlbedo.a;

return litColor;

在PBR出現之前,3d界如何做」真實感「渲染的?

FXCarl 真實感 和 PBR 沒有任何聯絡,你肯定見過超寫實主義油畫,滿滿真實感,但毫無 PBR。你的紅框中的內容,其實是 實時光照 與 預渲染 之間的差異。 周源 出現之前也並不是要死記硬背引數的,是用材質庫。甚至於也有一些有各種貼圖的通用材質。pbr在我看來更主要的是建立了統一的規範和理念。...

如何讓守望先鋒起死回生

更新!更新!更新!先出他娘10個新英雄 在來三四個新模式 我們是普通玩家,不是職業的OK?別天天只關注你那該死的職業比賽,沒有玩家,有人還關注比賽嗎?你把英雄按愚人節模式那時候那樣改,英雄四個月乙個,地圖一年乙個,222模式靈活一點,把本來只能乙個人乙個位置改成每個位置各兩個英雄讓玩家去自己換。學著...

守望先鋒如何怎麼做到特別順滑的瞄準?

Andiii 不是手腕流800 7?我也是手腕流我覺得對我來說1600 13最舒服。幾乎是你的四倍了但對我來說精確瞄準很難比如說開鏡甩頭那種那總體還是很順滑雖然不主玩槍位但有個鑽石水平 知秋落 換顯示卡 2060s及以上 換144 換滑鼠推薦g302或者gpro 個人喜歡小鼠換滑鼠墊也不一定要特別好...