Hot answers tagged

36

Using RTT (render-to-texture) allows to easily scale rendering quality (resolution, LOD, lighting complexity) for adjustable performance. RTT also makes it easier to replace the surface with a cubemap at a certain distance where it's hard to see the reflection exactly. Since the output is a texture, there are more options regarding what can be done with it ...


28

No, you are wrong - that's not how Duke Nukem 3D's mirrors worked at all. DN3D used a portal engine. A joint between any two sectors was arbitrary to an extent, and when the rendering engine came to a portal, it knew that it has to start rendering another sector in that. The sector behind the mirror was basically a place holder to deal with a quirk in the ...


5

I don't think this is going to be quite as easy as you'd like, that said you should be able to copy/paste the code below to get something going. There might be a better way to approach this, but as I see it you'll need 2 render passes. The first to render the scene to a low resolution to introduce pixelation, and a second to resample the low resolution ...


4

I believe that might be related to "shadow acne." Try lowering the bias of your directional lights. http://answers.unity3d.com/questions/925812/unity-5-real-time-lights-cast-shadows-with-gaps-li.html


3

RTT would have been used if it was possible but the hardware rendering pipeline was one way. Older hardware also had limitations that prevented render to texture. Writing to RAM means it can not be read at the same time. To improve rendering performance the destination buffer was locked to write only, only the display hardware could read from it. You could ...


3

One obvious error in your current implementation is that you should combine nodes based on their total area, and not total radius. Otherwise you're overstating the visual effect by a squared factor - remember the area formula, pi*r^2. But you'll still run into other artifacts. An obvious one is that when you are zooming or refining your detail, there will ...


2

The idea is simple. You need to have a way to define an object on the screen. It should contain the information for the rendering (like textures, effects, etc.) and for the game logic (velocity, acceleration, etc.). The main game logic shouldn't touch the rendering parts and vice-versa. There are variables, which needs to be used by both systems (like the ...


2

Changing shader properties for each camera You can accomplish this with a script on the camera. In my example I change the color but you can extend this idea to any property in the shader. [ExecuteInEditMode] public class CameraMaterialChanger : MonoBehaviour { public Color myColor; // color you want the camera to render it as public Material ...


2

You are loading part.png and creating the surface for each tail part in a loop. That's incredibly slow. Instead you should load it once, at the program initialization and just use it in drawing. You should get rid of these in drawPart(): auto surface = IMG_Load("part.png"); texture = SDL_CreateTextureFromSurface(renderer, surface); SDL_FreeSurface(surface);


1

Duke Nukem handle that by re-rendering the geometry behind the mirror, the other answers are partially correct. There are areas behind mirrors that actually contains no geometry (in game data files), the geometry is re-rendered at run time infact, the reason for those areas to exist is to avoid to place accidentally a piece of level there when editing the ...


1

OK, assuming that render() gets called once per frame you are telling your game to create 5 new enemies every frame in the tile class. This would lead to creating hundreds of enemies per second. I think you only want to use that for loop once when initialising the game. That way you will only make 5 (until you decide to make more). look in the ...


1

If you're going to use two images anyways, why don't you simply just have one image without an outline and one with an outline and just swap between them? As for other methods of drawing an outline, it can be done using multiple methods. If you're going to draw an outline on simple textures (let's say a square) use a ShapeRenderer (docs & tutorial) and ...


1

For no apparent reason, you are filling your loaded image with a solid white color using SDL_FillRect. Also, you seem to clear the renderer without rerendering the texture. You need to SDL_RenderCopy the texture again after clearing the renderer.


1

EDIT: @Bálint made a great point about my answer. This works best for 2D rendering frameworks (SDL, XNA, etc) and less so with working directly with things like DirectX/OpenGL, which require a much closer coupling of the WHAT, WHERE, and HOW that I list below. Here is the paradigm I follow with how I organize my classes and what responsibilities each has: ...



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