[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/3/ - 3DCG


View post   

File: 34 KB, 498x262, shader-tutorial-banner.jpg [View same] [iqdb] [saucenao] [google]
453493 No.453493 [Reply] [Original]

Hello people.
I'm looking to learn about shaders, currently im a game developer working mostly on Unity.
I have the math base and know the basic of OpenGL.

But i dont know how to continue this adventure... maybe there is a basic book or something i dont know.

Any guide line will be apreciated!

>> No.453512

"Shaders" is a pretty broad topic.

If you know about OpenGL, then maybe you've heard of the "fixed function pipeline?" It was the old way of doing things. There was a "pipeline" and triangles went into the pipeline and a bunch of math happened... Like transforms (just a bunch of matrix multiplication) and lighting (some dot products and more multiplications) and then filling (basically just interpolating colors as you walk across the pixels of the triangle that you're drawing).

So, someone smart said "why should all that stuff be fixed, why can't I write little programs that tell the GPU how to do that math, instead?" Those little programs are shaders. You can choose to do transforms and lighting and filling any way you choose by writing code.

>> No.453513

Recently found this book. Its a-fucking-mazing, and seems like its easy enough for beginners to understand.

http://vdisk.weibo.com/s/aQZzTq6J8Wjsg

>> No.453514

>>453512
>Those little programs are shaders. You can choose to do transforms and lighting and filling any way you choose by writing code.

LOL thats how fixed function works too you idiot

>> No.453517

>>453513
Thanks!
>>453512
Yeah , i studied that chapter of the history of GPU.
My problem it's that i find really hard to put in some line the things i want to do to get better at this.

For example, when i started studying programming my steps were... "Print something, catch input, show something on screen, learn about design patron, etc".
With shaders i dont know how to start really. :P

>> No.453521

>>453517
>With shaders i dont know how to start really. :P
Maybe you should start with n dot l you fucking retard

>> No.453522

>>453514
LOL no it isn't, hence the name "fixed function"
Welcome to /3/
Enjoy your stay
We're glad you're here
We're glad you are alive

>> No.453523

>>453517
>>453521
You could start with a shader that just returns a solid color. Then do "n dot l" as the "fucking retard" guy suggests. There are a lot of middle schoolers on /3/ so you just have to roll with it.

>> No.453524

>>453522
Yup, it is. I use the fixed function pipeline all day every day, in fact using it now.

>> No.453525

>>453524
You're using shaders to do what the fixed function pipeline *used* to do, back in the day before there were shaders. Not everyone here is 12, bro. Some of us actually existed before shaders and used an actual "fixed function pipeline." I think /vp/ would be better suited to your tastes.

>> No.453526

>>453525
No, I program opengl #110 with fixed function without any shaders kiddo.

>> No.453527

Jesus just stop this shit nobody cares about your fixed functions. The book I linked will explain it sufficiently to OP.

Now instead maybe tell us something different so I can learn something from this.

>> No.453528

>>453527
Just admit that you were wrong and dont know what you're talking about in terms of opengl graphics programming in a fixed function pipeline.

I'll wait.

>> No.453530

>>453521
Besides de "fucking retard" part... the n dot l looks like a good "Hello World" and a good point to start (while i read the new book). So Thanks...
-

We are not here to start a competition or anything... so, stop the shitty comments please...

>> No.453531

>>453528
Yeah buddy I'm not even the same person you were arguing, im the guy who posted the book. Enjoy your wait.

And when I said tell us something useful, I certainly wasnt talking to you. Even I know youre full of shit.

>> No.453532

>>453526
I think maybe you just don't understand English.
If you're writing programs to run on the GPU, those are called "shaders." If you are just writing C or C++ code that calls the OpenGL API, then that code is not running on the GPU and you are not writing shaders. OpenGL, under the hood, may or may not be using shaders. You simply can't have both shaders and fixed function. I'm sorry if that hurts your feelings.

>> No.453533

>>453527
>Jesus just stop this shit nobody cares
>>453530
>stop the shitty comments please...
First time on 4chan, friend?
We're not here to help you.

>> No.453535

>>453533
Hey OP, we're the same person :3

>> No.453538

>>453533
Yes its my first time, please be gentile. faggot-sama

>> No.453555

>>453532
>it either will....or it wont
you're a backpedalling idiot. like i said, admit that you were wrong and dont know jack about opengl fixed function graphics programming.

>> No.453563
File: 137 KB, 550x413, 1356314622055.jpg [View same] [iqdb] [saucenao] [google]
453563

>>453555
god i fucking hate programmers.

>> No.453566

This whole thread is full of retards.

>> No.453567

>>453566
You're projecting again. The only one with retardation is >>453532

>> No.453568
File: 249 KB, 400x384, 14b.png [View same] [iqdb] [saucenao] [google]
453568

>>453563
ikr, so sad they are sad fat and mad irl

>> No.453583

>>453493
Use ShaderForge, it's amazing. It's only $80, and it does so much. If you've ever made materials in UDK, or if you have common sense and a basic sense of math and trig, you'll be fine.

>> No.453610

>>453555
You are lost. And embarrassing.

>>453563
You flatter him by calling him a programmer. It sounds like he just half attempted "hello world" in OpenGL and now tells everyone that he "programs" "shaders" in the "fixed function pipeline." I can imagine the puzzled looks he gets.

>> No.453611
File: 94 KB, 1179x624, SkinSSS.jpg [View same] [iqdb] [saucenao] [google]
453611

>>453583
Or just consider the fact that a lot of shader development has moved away from coding. If you want to code shaders just for the experience of learning to code shaders, that's cool. But it has kind of all been done at this point, so most people avoid reinventing the wheel by just using a point-and-click interface like pic related (from UE4).

>> No.453612

>>453611
lol, spaghetti mess already. Plus its fucking PROPRIETARY LMAO!!!!

>> No.453613

>>453612
Not everyone is as poor as you. $19 for a professional engine is ridiculously cheap. And if you look at a graph that simple and see "spaghetti mess," you might not be cut out for programming... or computers... or just day to day life.

>> No.453614
File: 8 KB, 192x171, 1407015527963.jpg [View same] [iqdb] [saucenao] [google]
453614

>>453613
>resorting to insults and personal attacks this early
>defending proprietary software this desperately, like a kid clinging to his mothers teat

>> No.453620

>>453614
Not him; just popping by to say that graph is extremely simple and straight forward and your trolling is really pathetic, maybe you should practice on /lgbt/ or /pol/ or something first before you try to run with the big dogs on /3/

>> No.453622

>>453533
>We're not here to help you.

Anon, your here to suffer. Forever.

>> No.453639

>>453611
Can you write custom functions and extend them or is it like a fixed library of functions one must select from?

If the former and you can look at the resulting code in text form that there would be really cool.

>> No.453646
File: 8 KB, 322x322, 1294835204935.jpg [View same] [iqdb] [saucenao] [google]
453646

>>453620
>Not him
only samefags post this

>> No.453693

>>453646
I'm not him but he's retarded

>> No.453706

>>453622
Oh, believe me, I've been here long enough to know this. OP just apparently didn't get the memo.

>>453639
Yes, you can write anything custom that you like. UE4 comes with complete source code and you can extend it either by writing more code (C++) or by using their visual scripting system (like the image). I'm not sure about viewing the actual shader code generated from a material script, but I assume it's possible. Not something I've ever needed to do.

>> No.453719

>>453524
isnt fixed pipeline that shitty glBegin().....glEnd() bullshit. no one uses that anymore lol
better off just writing rly basic shaders then go back and make them fancy after everything is working correctly.

>> No.453727

>>453719
you don't know what you're talking about lets just leave it at that.

>> No.453736

>>453514
Well, yes, on some level. But the main limitation of the Fixed Function are the limitations. You're stuck with whatever modes your graphics card or graphics library already has built in.

Most FF pipelines don't have built-in modes for normal mapping, specularity, blending, or anything beyond basic transform and lighting. Access to the programmable pipeline opens up a lot of freedom, and with each layer of the pipeline being opened up, allows you to do things that nobody thought graphics cards were able to do.

Like, for instance, waves, physics, tessellation, HDR, refraction, displacement.

>>453493
The unity shader manual actually has a really decent set of basic vertex and fragment shaders. Outside of that, look into the Unity Community wiki. Tonnes of shit there.

There's a soft limit to what you can do with just plain shaders. Don't be afraid to integrate some of your graphics into your regular runtime stuff. A lot of games rely on stupid dwarf tricks and handing uniforms back and forth.

Most games rely on only a handful of shaders, most of which will be your common bump-specular-diffuse shaders. You'll occasionally see a few specialized shaders for rim lighting and outlining.

Unless you have some very specific requirements, you're probably going to maintain the same vertex shaders throughout. You can do some fun stuff like world-distortion, and you can even sneak animation transforms into the vertex shader.

>> No.455125
File: 15 KB, 475x202, MV5BMjA2NTc3NDIxMV5BMl5BanBnXkFtZTYwMTAwMDg2._V1_SX640_SY720_.jpg [View same] [iqdb] [saucenao] [google]
455125

This seems like an appropriate thread in which to ask this question:

What would be the proper workflow for creating a cel-shaded render using the ShaderFX Shader in Maya 2015?

I believe Ramp Shaders are how the cel-shading look is achieved, but I'm not sure how much more there is to it than that.

Do ShaderFX Shaders render in mental ray? Or just Maya Software? Any other render engines (Arnold, maybe?) for Maya that might be better suited for cel-shading a seen?

>> No.455128

>>455125
Don't use shaderFX. Use mia_mat_x and input ramp shaders to ambience/diffuse.
You have a lot more control using mia than shaderFX. I only have experience with mental ray and vray so i don't know if other renderers would be better suited. I just know from personal experience that shaderFX is quite bad.

>> No.455133

>>455128
>Don't use shaderFX. Use mia_mat_x and input ramp shaders to ambience/diffuse.
Well, I do most of my texturing and detailing in Substance Painter, which uses diffuse, roughness, metallic, emissive, and other maps that aren't really useful to the mia_material_x shader (as far as I'm aware, anyway). ShaderFX lets me use the TraditionalGameShader node to use the detail maps I created in Substance Painter.

>> No.455135

>>455133
mia_mat_x has inputs for diffuse roughness and emissive, amongst others. "metallic" is just a matter of balancing gloss and reflectivity, which you can also map.

>> No.455137

>>455135
Does mental ray do cel-shading well? I wasn't planning on using mental ray to render the scene unless I had to, really. I'm going for near-realtime rendering with this project. Nothing too fancy.

It's gonna be a character model + clothes each with 2K texture maps for diffuse, normal, roughness, and probably a few more attributes. The model will be rigged and doing a short animation. Backdrop probably won't be anything special.

Basically I'm trying to practice my game-asset-creation workflow, but using ShaderFX and cel-shading.

>> No.455138

>>455137
If you're going with real-time rendering, then just render with Viewport 2.0, and enabled DepthMap Shadows on your lights. You can also enable Anti-Aliasing, Motion-Blur, proper transparency, and Ambient Occlusion in your VP2.0 viewport settings.

Mentalray is meant for creating realism, which cellshading is not. Though you can do it properly if you want, but that's not what a raytracer is geared towards...

So just use ShaderFX with VP2.0. You can set VP2.0 as your actual renderer as well.

>> No.455142

>>455138
even with depth peeling transparency doesn't draw properly in some cases in VP2.0. Same goes for certain light set-ups.
What's the point in going for real-time rendering unless it's interactive? If it was going to be a game then you wouldn't be building shaders in Maya anyway.

>> No.455146

>>455142
> you wouldn't be building shaders in Maya anyway.

Maya's ShaderFX system exports the shading networks to Unreal and Unity...

>even with depth peeling transparency doesn't draw properly in some cases in VP2.0
It depends on the shaders you're using, just like with games. You can use shaders that give you more realistic transparency and refraction if you want even.

But I do agree that unless you're making something for interactive, then just do offline rendering.

>> No.455696
File: 109 KB, 384x254, _-Starfox-SNES-_.gif [View same] [iqdb] [saucenao] [google]
455696

In 3DS Max, is it possible to make a shader that just applies flat colors, with no hotspot or shading to every smoothing group on a model? Think like the original Star Fox on SNES.

Alternatively, does anyone have a way to render out with jaggies?

>> No.455698

>>455696
Lol...

Yes, just apply a surface shader.

Uhh, to render out with Jaggies just disable anti-aliasing... or render at half resolution and then scale the image up by nearest neighbor in Photoshop.

>> No.455699

>>455698
Is a 'surface shader' just a Maya term? I can't find the equivalent in Max.

>> No.455706

>>455699
search "surface shader in max"

>> No.455709
File: 2 KB, 300x300, cube.gif [View same] [iqdb] [saucenao] [google]
455709

>>455706
Only one result, and they pretty much just said use a self-illuminated material.

That makes something a solid color, but I'm talking about also having each facet be a different shade of said color.

Kinda like this cube.

>> No.455723
File: 1.34 MB, 1330x2884, how to starfox starwing starve a image back to shit.jpg [View same] [iqdb] [saucenao] [google]
455723

>>455696
It's possible, just follow my insightful tutorial.

>> No.455735
File: 246 KB, 680x677, goodpost.png [View same] [iqdb] [saucenao] [google]
455735

I love tutorials like this.

>> No.455760

>>455723
perfect