Download

Planning on learning OpenGl and HLSL

Hello everyone…

I am a C++ programmer and I have a good knowledge on Unreal Engine 4 by now…
I am planning on learning either OpenGL or HLSL next.

I have used a HLSL little in the past and interested in learning it. I want to know what will be advantage of leaning either DirectX or OpenGl and is there way I can use that knowledge in UE4?

They are both good APIs. OpenGL is arguably better for low level coding. The PS4’s API is based off OpenGL. DirectX is built into UE4 and you can run profiling tools for it with “D3D11RHI” console command.

My recommendation its to learn OpenGL, but both have its downsides.
OpenGL: Upsides: Works on literally everything with a GPU, lots of extensions that add functionality if you want to use them, can be a tiny bit faster.
Downsides: Practically impossible to learn, the official docs arent for noobs, they are just an API, trying to find tutorials in internet its really, REALLY hard, becouse opengl doesn delete old functionality, you have like 6 ways of drawing a vertex triangle on the screen, and 4 of those are too old and not optimized at all. Driver support its absolutely terrible.

DirectX: Upsides: Easier to find proper tutorials, much better drivers.
Downsides: Its microsoft, owned by them, and only works on windows PC and Xbox, unlike opengl, wich works on everything, even phones.

I chose Opengl becouse i wanted to also program for linux, and maybe phones. But its been ridiculously hard to find up-to-date tutorials, most of the popular ones are for the way it was done 15 years ago, something like if you were learning DirectX 7 or so. This http://www.openglsuperbible.com/ is the best book you can probably buy as a noob, and has only the bleeding edge stuff, equivalent to directx11, no ancient trash there.

Looking forward to learn Vulkan, OpenGL equivalent to directx 12 (instead of making opengl 5, they decided to start clean). But i hope the khronos group isnt as incompetent as usual and actually do a good job, competing with DX12.

I wanted to know if learning OpenGL will help me in anyway while working with UE4?
Currently I am working with only UE4 for the time being.

Neither OpenGL or DirectX will help you in any way while working with UE4, those are graphics API to speak with the GPU, UE4 does all of that for you without you doing a thing. Learning those for ue4 would be just so you know a bit more whats under the hood.

Ah okay… I wanted to know how Matrices are used for rendering and related things… Planning to go with OpenGL.Then again I wanted to learn HLSL first as it might help me during the creation of a few shaders.

Learning shaders is very useful in UE4, since material editor is practicly shader editor, when you understand shaders you understand material editor more

Here is a fun site which let you toy with shader code:
http://glslsandbox.com/
But you need to keep in mind this is using WebGL which is equivalent of OpenGL ES2 which is more limited the desktop shaders… but it help you forge fundamentials in head. You also need to remember that Material Editor does not provide functions, so some things are hard to reproduce in material editor

Its actually almost better to try to learn openglES 2 becouse its the “no ********” edition, you only have the main ways to do stuff, and only the newer ways. That makes tutorials be actually useful and not outdated.

We can write custom HLSL shader in material editor right(the custom node)? Although I think its kind of limited. And what about this A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums.

Yes, but there warning in documentation that it does not work well with anything else then HLSL as it adds code as it is without translating it, so it’s only good if you plan to run game only on Windows and maybe Xbox. You also need to remeber that this node works like function, code you type in will be placed inside the function, so also there you won’t be able to use functions, there a hack will let you do that (as you can call generated function) but it’s very risky thing to do, it also force you to create very strange node networks.

As for custom shaders, yea thats possible too :slight_smile: but it’s more advance, if you ready for it go ahead