Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

128 Neutral

About FSA

  • Rank
  1. Thank you :) Yes I know that. But how should I implement the reflectance?
  2. Hello! Currently I'm trying to implement a PBR shader. And now I want to know how you've implemented rougness. My idea is to have a cubemap with MIP levels and sample the cubemap on a certain level depending on the roughness value.   float3 reflectedColor = cubeMap.SampleLevel(samplerCube, R, nMips - roughness * nMips).rgb; nMips is the number of MIP levels in the texture.   But this approach doesn't look so nice. You can see an example in the picture. So how did you guys do it?   Thanks :)
  3. No idea? Need additional information?
  4. Hello! I'm trying to implement parallax corrected cube maps based on http://www.gamedev.net/topic/568829-box-projected-cubemap-environment-mapping/   These are my render steps: 1. Render a cubemap out of the view of a camera, which can be freely positioned. 2. Render scene normally with parallax corrected cube mapping shader: float3 EnvBoxMax = {10.0f, 10.0f, 10.0f}; float3 EnvBoxMin = {-10.0f, -10.0f, -10.0f}; float3 EnvBoxPos = {0.0f, 0.0f, 0.0f}; float3 N = normalize(IN.normalW); float3 I = IN.positionW - viewPosition; I = normalize(I); float3 R = reflect(I, N); // BPCEM float3 nrdir = normalize(R); float3 rbmax = (EnvBoxMax - IN.positionW) / nrdir; float3 rbmin = (EnvBoxMin - IN.positionW) / nrdir; float3 rbminmax = (nrdir > 0.0f) ? rbmax : rbmin; float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z); float3 posonbox = IN.positionW + nrdir * fa; R = posonbox - EnvBoxPos; float3 reflectedColor = cubeMap.SampleLevel(samplerCube, R, nMips - gloss * nMips).rgb; float3 d = DiffuseMapTexture.Sample(sampler2d, IN.texCoord).rgb; float3 color = lerp(d, reflectedColor, refl); return float4(color.r, color.g, color.b, 1.0f); Now the problem is when I move my object, which reflects (and also move the view position for rendering the cube map and set the EnvBoxPos value in the shader to the new position) I only get artifacts.   The image is rendered with following values: EnvBoxMax = {10.0f, 10.0f, 10.0f}; EnvBoxMin = {-10.0f, -10.0f, -10.0f}; EnvBoxPos = {55.0f, 10.0f, 0.0} CameraPosition, which renders the cube map: {55.0f, 0.0f, 0.0f} And all object are translated +50 in the X direction.   Thanks for your help!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!