graphics programmers interview: draw a checkboard html programmers interview: reverse this binary tree
@wall-wrecker-my6ss Жыл бұрын
sounds like false
@kolupsy Жыл бұрын
I was looking at the article and was pretty proud of myself for being able to answer most of the generalist interview question while being able to provide more in-depth information or explanations to a topic.
@SuboptimalEng Жыл бұрын
That's pretty good! I've still got to learn more before I can answer all the questions.
@dusha3030 Жыл бұрын
It may be dumb but couldn't we just do this ? mod(floor(10.0*uv.x) + floor(10.0*uv.y), 2.0);
@SuboptimalEng Жыл бұрын
I expanded my code to keep it simple for someone who might not be familiar with writing shaders. I’d definitely go with your approach if I was doing code golf!
@Po4toАй бұрын
My take was to fract() vertical and horizontal black & white gradients and round() the values: below .5 would be black, above - white. Then subtract the value of the vertical gradient from the horizontal, and get an abs() value of that, These would give one of four results: abs(1 - 0) = 1, ergo white abs(0 - 1) = abs(-1) = 1, ergo also white abs(0 - 0) = 0, ergo black abs(1 - 1) = 0, ergo also black But even going full brut, with just fragColor = vec4(abs(round(fract(vec3(uv.x/.3))) - round(fract(vec3(uv.y/.3)))), 1); I would not win this golf match ;) Still, this kind of problems is very thought-provoking. I'm new to webGL and not very advanced in coding or math either - but I'm having a lot of fun and that pushes me to learn more.
@SuboptimalEngАй бұрын
That’s a smart way to solve the same problem. Thanks for sharing! Writing shaders is so fun because it combines art with math and programming 😁
@alexfrozen8 ай бұрын
Compare speed and size with this one: vec3 color = smoothstep(-.01,.01,vec3(sin(uv.x*10.)*sin(uv.y*10.)));
@SuboptimalEng8 ай бұрын
I kept my code verbose to help with the video explanation! It can easily be written better and your code is a good example 🤓