1
\$\begingroup\$

I have a question about something I don't really understand. In OpenTK, should I have shaders? Is it frowned upon not to? What are the pros and cons of having shaders? Can I go perfectly fine without having anything to do with vertex or fragment shaders?

\$\endgroup\$
-1
\$\begingroup\$

In OpenTK, should I have shaders?

Generally yes; however, it largely depends on the context. See below for why.

Is it frowned upon not to?

Generally yes; however, it largely depends on the context:

If your game uses lighting: Yes

If your game doesn't use lighting: No, it's not necessary.

What are the pros and cons of having shaders?

Bobobobo's answer at https://gamedev.stackexchange.com/a/22069/91298 answers this; however, I'll try to give a more in-depth explanation.

Shaders uses the texture, available light sources, and the camera position to color the objects in your scene appropriately. This results in objects casting shadows and carrying shades. Without it, everything carries a monotone color. The underside of a desk is the same color as the top side regardless of a floor or ceiling light. A character casts shadows that shrink and elongate as they pass by lights. Vehicles and large objects carry different shades on thier various faces that gives them character. Lighted objects, such as rockets, or energy pulses light up their surrounding area.

Alternatively, if you're designing a game without lighting, such as a puzzle game (luxor comes to mind) then it's not strictly necessary. That being said, adding lighting would give any 3d or 2d objects character which may improve User Experience. Using Luxor as an example, the marbles are 3d. Add lighting, and the 2d field simulates depth.

Can I go perfectly fine without having anything to do with vertex or fragment shaders?

Technically: Yes. Shaders merely add coloring to the scene. If user experience isn't a big deal, then you can live without it. If you're new to this, then I'd recommend you try a few TK tutorials using shaders. Once you understand how to make them, then you can determine if the extra work you invest will be worth the UX they add to the game.

As an example, Minecraft has an option to turn off shaders. If you have the game, try flipping it on and off. In some places the difference is minute; in others, and with detailed textures, it's makes an incredible difference.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Sorry to say but shaders do much more than "merely add coloring", you talk like all shaders do is add lighting and coloring. Shaders do everything on a modern GPU.... Like expanding a point into a quad, tile based light culling, particle simulations, noise generation for terrain. Without shaders nothing get drawn unless you are using the old fixed function pipeline. There is lots of miss information in this answer. \$\endgroup\$ Nov 29 '16 at 0:42
  • 1
    \$\begingroup\$ If all I need to do is render textured quads, have some basic lights and possibly small particle effects, are shaders are good idea? \$\endgroup\$
    – user81509
    Nov 29 '16 at 2:24
  • \$\begingroup\$ Yes 100% you want shaders, shaders are what make your game look unique I really cant even imagine not using shaders. I'm not sure how the samples are for openTK but I started with XNA then once I had that down I moved over to sharpDX so since 2010 I have been using shaders. I would start with a sample that has some stuff you want and then pull it apart and rewrite it so u understand how it works. \$\endgroup\$ Nov 29 '16 at 3:22
  • \$\begingroup\$ Please make another answer if this one isn't correct \$\endgroup\$
    – user81509
    Nov 29 '16 at 22:01
  • \$\begingroup\$ @DenverP. if all you want are textured, alpha blended quads and basic post-FX you don't need shaders. Even without shaders, you have the option to render to texture and have vast array of alpha blending modes, stencil testing, which allows to create wide variety of post-processing FX. Great many 2D games from SNES, Sega Genesis GBA, PS1, Dreamcast, PS2 era didn't have "shaders" in the traditional sense. \$\endgroup\$
    – JBeurer
    Dec 28 '16 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy