小张学AI 2025-03-20 发布于山东 | 转藏 · 大家好,我是 同学小张,日常分享AI知识和实战案例 · 欢迎 点赞 + 关注 👏,持续学习,持续干货输出。 👀 看过来!今天教你再进一步,让D物体更更更真实。今天咱们来聊一聊 OpenGL 中的光照贴图! 1. 为啥要搞光照贴图? 前面我们学给物体加材质,让不同物体对光照有不同反应。但问题是,现实中的物体一个比一个复杂,光靠之前那种给整个物体一个统一材质的方法,根本不够看。像一辆车,车外壳贼亮,轮胎没啥高光,轮毂又特别闪。要是还用之前那套,整个车的材质都一样,那看起来得多假? 所以,光照贴图就来了!它能让你对物体的漫反射(diffuse)和镜面反射(specular)成分进行更精确的控制。 2.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by glActive Texture
Compute shader returning coordinates
taby said: My size_x and size_y variables are set to 128 x 128. The output is clearly outside of this range for some pixels. Is it? I can't see a number larger than 16384 in the (truncated) output. But the problem i see is: I would expect a pattern of (numX,numY,0,0), but it is (num,0). I guess you somehow convert 4 16bit numbers into 2 32bit numbers for the printed output. Maybe it's just that.
Zoom issue
ð Celebrating 25 Years of GameDev.net! ð Not many can claim 25 years on the Internet! Join us in celebrating this milestone.
[11/52] OpenGL is Still Decent, Actually
I know... I promised I'd be doing more engineering. We'll get there! But I was consuming some interesting digital creator / software engineering content the other day. There was one guy in particular (I won't say exactly who) who tends to do pretty interesting stuff, but who can be a little bit iconoclastic. He went on a weird rant about how obscure, obtuse, and inaccessible OpenGL is.
Depth texture as render target
//init func //---------------------- //FRONT //---------------------- glGenFramebuffers(1, &m_FrameBufferFront); glBindFramebuffer(GL_FRAMEBUFFER, m_FrameBufferFront); glGenTextures(1, &m_RenderedTextureFront); glBindTexture(GL_TEXTURE_2D, m_RenderedTextureFront); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 800, 600, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);...
OpenGL-ES 学习(2)---- DepthTest
深度测试 OpenGL-ES 深度测试是指在片段着色器执行之后,利用深度缓冲区所保存的深度值决定当前片段是否被丢弃的过程 深度缓冲区通常和颜色缓冲区有着相同的宽度和高度,一般由窗口系统自动创建并将其深度值存储为 16、 24 或 32 位浮点数。(注意只保存深度值) 当深度测试开启的时候, OpenGL-ES 才会测试深度缓冲区中的深度值;如果此测试通过,深度缓冲内的值可以被设为新的深度值;如果深度测试失败,则丢弃该片段。 深度测试是在片段着色器运行之后(并且在模板测试运行之后)在屏幕空间 (screen space) 中执行的。 与屏幕空间坐标相关的视区是由 OpenGL-ES 的视口设置函数 glViewport 函数给定,并且可以通过片段着色器中内置的 gl_FragCoord 变量访问。 gl_FragCoord 的 X 和 y 表示该片段的屏幕空间坐标 ((0,0) 在左下角),其取值范围由 glViewport 函数决定,屏幕空间坐标原点位于左下角。 gl_FragCoord 还包含一个 z 坐标,它包含了片段的实际深度值,此 z...
LearnOpenGL-高级OpenGL-3.混合_刘建杰的博客-CSDN博客
我写的项目地址:https://github.com/liujianjie/LearnOpenGLProject 有点长的介绍 OpenGL中,混合(Blending)通常是实现物体透明度(Transparency)的一种技术 透明就是说一个物体(或者其中的一部分)不是纯色(Solid Color)的,它的颜色是物体本身的颜色和它背后其它物体的颜色的不同强度结合。 一个有色玻璃窗是一个透明的物体,玻璃有它自己的颜色,但它最终的颜色还包含了玻璃之后所有物体的颜色。 这也是混合这一名字的出处,我们混合(Blend)(不同物体的)多种颜色为一种颜色。所以透明度能让我们看穿物体。 图示 透明的物体可以是完全透明的(让所有的颜色穿过),或者是半透明的(它让颜色通过,同时也会显示自身的颜色)。 一个物体的透明度是通过它颜色的alpha值来决定的 当alpha值为0.5时,物体的颜色有50%是来自物体自身的颜色,50%来自背后物体的颜色。 有些图片并不需要半透明,只需要根据纹理颜色值,显示一部分,或者不显示一部分,没有中间情况。 例子...
Replacing glCopyImageSubData
I'm currently using glCopyImageSubData to copy from texture to texture. It works fine, but I'm trying to replace it with the following code. It doesn't work, failing on the copy back to the GPU.
Shadow Mapping does not display correctly - dark square on the ground
I try to make shadow mapping with opengl es 3 but it does not work correctly. I tried with several scenes but each time I have a part of projected shadow and another part of black square. I can provide other visuals or explaination if needed.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with glActive
Contact glActive, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack