Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Shader Tutorials 101 - Master Post

Author
Message
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 20th May 2014 22:04 Edited at: 20th May 2014 23:03
(Note @ moderators: Originally I was going to host these externally, but decided it would be better to embed them into TGC forums. I hope the two threads aren't too much of a hassle, if so, you may delete the other one and I can append it to this thread instead.)

I've had these as a draft for a while. Big shoutout to Green Gandalf for reviewing them and giving me feedback!

Your feedback is highly valued in order to improve the quality of these tutorials, so if you have any feedback, please post below.

Shader related questions should be directed to the existing shader thread.
[EDIT] Apparently that was locked. Unlock?


TheComet's Shader Tutorials 101

Outstanding Support Provided by Green Gandalf


Master Post



Introduction

Shaders are still considered by many in the DBP programming community a form of black magic. There's no easy entry point for the total beginner, and the existing shaders aren't very helpful due to the lack of comments and sheer amount of mathematics in the code.

These series are my attempt at making it easy for the total beginner to start programming shaders by shallowly introducing you to basic concepts and techniques.



What will I need?

You will need a DBP compiler. DarkShader is a nice-to-have, but it's not necessarily needed to get through these tutorials.

In order to benefit the most from these series, download the examples, and try to understand them as you read the tutorials. Also feel free to do your own experiments! There's no better way to learn than by doing.

Do your experiments in the folder PLAYGROUND in the examples you downloaded. It contains a basic shader program loaded by DBP, and is intended to be used for all of your testing/experimenting. This way, you aren't changing the examples,



Tutorial Content

Ground Zero
* 01 - The Graphics Pipeline - Learn what the GPU is and how it works, and when it makes sense to use the GPU over the CPU.
* 02 - Writing Your First Shader - Introduction to HLSL. Writing your very first shader. What are shader semantics? How are vertices projected?
* 03 - Vertex Shader Coordinate System - What coordinate system is used? Why are the coordinates 4-dimensional?
* 04 - Vertex Normals - What are normals? Manipulating vertices using the vertex shader.
* 05 - UV Coordinates - What are UV coordinates? How is a texture mapped to an object?
* 06 - Sampling a Texture - Using UV coordinates to sample a texture using the pixel shader.

Basic Lighting Techniques
WIP



Feel free to leave feedback to help improve the information provided! And always remember: If you run into trouble, the forums are here to help.

Happy shader coding!
TheComet

Your mod has been erased by a signature

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-05-17 09:19:20
Your offset time is: 2024-05-17 09:19:20