Hot answers tagged

50

There are many places where HDR makes a difference besides providing source data to base a bloom filter on. Essentially, anyplace where lighting values are scaled or added together is going to look different, and will be more realistic / physically correct when done in HDR. One of the most obvious places where it matters is with environment reflections. ...


31

While this answer does not tell what is wrong with your approach, it presents a simpler way to render skyboxes. Traditional way (textured cube) A straightforward way for creating skyboxes is to render a textured cube centered to the camera position. Each face of the cube consists of two triangles and a 2D texture (or part of an atlas). Due to texture ...


5

glDepthRange (1, 1); Job's a good 'un, done. How this works: glDepthRange() remaps depth values for the purpose of interacting with the z-buffer. Setting glDepthRange(1,1); makes every fragment, regardless of how close or far it actually is from the camera, be treated as if it was exactly at the far plane. Remember to return it to its default ...


5

A simple method using only Photoshop: Crop the image vertically to remove anything that should be below the horizon (ie. not part of the sky dome) Scale up the height of the image to make it square Filter -> Distort -> Polar Coordinates


4

In fact you don't need to create a second matrix separately. To remove any translation you just need to cast the matrix to mat3 and back to mat4. It will change following numbers in the matrix - - - 0 - - - 0 - - - 0 0 0 0 1 effectively removing any translation.


3

Why render the sun into the skybox? Just render the skybox and then draw the sun without using a depth test. This way you don't have to modify any textures and then redraw them. It's much easier to draw the sun where it belongs that way, too. As Nicol Bolas mentions in the comment, you can put the sun behind the skybox if it's transparent. You might do ...


3

Sure, you can do that. For instance, if you want the color to change from skyNightColor at 4:00 to skyMorningColor at 7:00, you could write some code like if (currentHour >= 4 && currentHour < 7) color = lerp(skyNightColor, skyMorningColor, (currentHour - 4) / (7 - 4)); The expression (currentHour - 4) / (7 - 4) remaps currentHour ...


2

First, make sure you're not applying lighting to the skybox. It should be full brightness without any lights. Lights make box edges visible even without textures, so you're probably not doing that. Second, your choice of texture needs to be seamless and well chosen as a skybox texture(s). If you're rendering a literal sky box then the textures need to ...


2

Finally i solve and fix the problem by myself . Add GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead; before draw the skyBox And Add arcadia.Game.GraphicsDevice.DepthStencilState = DepthStencilState.Default; after finish draw the skyBox Full Code: #region DrawSky public void DrawSky() { arcadia.Game.GraphicsDevice....


2

MooseBoys is right when he says integrate the hemisphere about the normal And to some extend you are also right when you say that a low mipmap is doing that, but not 100% mathematically correct. What you need to have physically speaking, is a convolution with a cosine lobe in linear space. What you get with the mipmap sampling, is a convolution with a ...


2

That software you've linked seems to do what you want, but I presume you would need something that's free? This tutorial has a blender file that you can use (see section "CONVERT TO CUBE"): https://aerotwist.com/tutorials/create-your-own-environment-maps/


2

I figured it out. I forgot to set the "wrap mode" for each of the 6 textures to "clamp" rather than repeat. This seems to make all the difference when preventing seams for the skybox material.


2

What are the texture coordinates that you're using for those vertices? With D3DTADDRESS_CLAMP, they must be in the [0;1] range, anything else will be clamped to [0;1]. So, for example, using the [-1;0] coordinate range could cause this as it would make all of them effectively 0.


2

It's very easy to do this. Cube maps only need a 3d vector pointing in the looking direction. You can generate this in the shader. What you'll need to provide as uniforms are the aspect ratio, the FOV and the cube map. You need to render a quad that fills the whole screen and give it the usual texture coordinates between 0 and 1. First of all, let's ...


2

In your Assets folder, right click and select Create > Legacy > Cubemap Set the "Face Size" parameter to your desired resolution before you assign your textures - it won't re-import them automatically if you increase the size later. Assign your six textures to the six face fields. Now inside your shader graph, you can add a Cubemap property, and ...


2

So before you added frustum culling, the far-terrain was showing, and now it is not? I assume you draw your terrain in chunks, and some chunks are culled? Are you using an existing engine, or writing your own? It sounds like the far-plane of the culling frustum is set too close then. Are you sure that your projection matrix and frustum cull use the same ...


2

The traditional way to do that is to create a modelView matrix that contains only rotation information. It should contain the same rotations as the camera, but not the translation, so that it's always at the origin. Use that with the same projection matrix as you use for the rest of the scene. Draw your skybox centered at the origin. After you draw your ...


2

I found my error. The vertex shader outputs the homogeneous clip coordinates with SV_POSITION semantic before the model space position with POSITION semantic. The Pixel shader reads the input position from the first register so I was sampling the texture cube map using clip space coordinates, hence I was always facing the same direction. I was ignoring the ...


1

The skybox doesn't exist in world space so it never needs to have a position in world space. It should be rendered with a shader that takes into account its orientation and the camera's orientation and sets its camera space position to 0,0,0, so the camera is always at the center of the skybox. I've never tried it in VR, but if you draw the skybox this way ...


1

use this under any function if you want to remove for example in void Update() { RenderSettings.skybox = (null); or just use this RenderSetting.skybox = (null); public material = skyboxMat; to change skybox same RenderSetting.skybox = skyboxMat; is being used


1

I had the same issue on my project. If you're on Windows 10, I created a utility called Qbit that will export the six faces from the source image. There's a free version available here: https://pragmar.com/qbit/


1

Okay so I cannot open that link from where I am, but from what I can draw from your text, this is a shader for a cube map, right? The point of a cube map is that you (the camera) are always at the center of it. You only change the part of the map you can see by rotating your camera. You still are able to move the camera, the skybox just does not change then....


1

The solution for me was to re-order the right/left/front/back from the images I was getting online to different combinations in order to get it to look properly when rendering.


1

Im not entirely sure about this myself, but maybe your problem is that you dont have one. From the looks of it, your skybox is rotating correctly. Question now: I see you are initializing and uploading the view-matrix correctly, but what about the projection-matrix, i dont see that one. My guess is that your code is alright so far, but since you havent ...


1

First off, use this shader for your skybox: http://wiki.unity3d.com/index.php?title=SkyboxBlended The default Skybox shader won't allow you to transition between two skyboxes (eg. one for day, one for night). The "blended" value of this shader can be adjusted in code, so adjust it over and over a little bit every frame. Meanwhile, besides the skybox you ...


1

I didn't see any call to SwapBuffers after your draw commands. That's definitely a problem that will cause a blank screen. As long as there are no OpenGL errors, it's the only problem.


1

One way of handling this is to modify the depth range in your viewport when drawing the skybox. For XNA you would set both MinDepth and MaxDepth to 1, leaving the other members the same as your main viewport, like so: Viewport.MinDepth = 1.0f; Viewport.MaxDepth = 1.0f; This will ensure that your skybox is always drawn to the back of the scene, and using ...


Only top voted, non community-wiki answers of a minimum length are eligible