延迟渲染的一些思考

【Unity】什么是前向渲染、延迟渲染、单通道渲染、多通道渲染? 渲染路径深度解析:Unity光照计算的核心机制 本文系统剖析了前向与延迟渲染的技术原理及Unity优化实践。前向渲染采用逐物体处理方式,在片元着色器直接计算光源影响,优势在于天然支持半透明与MSAA,但受限于光源数量导致的Overdraw问题。Unity URP通过Clustered Forward技术将屏幕分块预处理光源分配,突破传统每物体4灯限制。延迟渲染则分离几何与光照阶段,通过G-Buffer存储表面数据,实现光源数量与几何复杂度的解耦,特别适合多光源场景,但存在高带宽消耗、透明渲染回退等问题。文章 阅读详情

    最近一直在准备开题,打算做延迟渲染(Deferred Shading)相关的实现。Deferred Shading是目前实现多动态光源实时渲染的最主流的技术了。其实Deferred Shading后面还有Deferred Lighting和Inferred Lighting这两种更先进一点的改进技术,可师兄师姐们的经验告诉我,开题不能开太难了。如果开题太难了,最后实现的时候实现不出来,那就是给自己找麻烦了。

    其实Deferred Shading技术在国外已经提出近20年了,在游戏中实际应用也有近10年了,近几年出的几个好的游戏引擎中几乎都用到了它。在国外,DS应该说是相当成熟了,可国内运用这种技术的引擎好像还没有听说过。我想并不是国内没有人会这种技术,网上很多博客都提到DS了,也有人自己实现了DS效果。只是这种技术对硬件的要求比较高,国内的游戏要照顾大多数的玩家。国外的玩家有可能因为想玩某个很酷的新游戏而升级硬件,国内几乎没有哪一款游戏有这种魅力。我想这也是为什么国内的游戏技术水平与国外的相差的不止一个级别的原因之一。

    国内有些研究过DS的朋友在网上公布了他们的研究结果,不过好像并没有想像中那么好。他们的实现中要么就没有考虑阴影(比如燕良的博客中的他实现的源代码和效果图,我还没有认真研究他的源码,不过从他的效果图中看不到有阴影的迹象。http://blog.youkuaiyun.com/yanonsoftware/archive/2007/05/14/1608621.aspx),要么考虑了阴影但光源数量达不到DS算法研究者声称的几十上百个动态光源的效果(吕希鸣的博客中有他实现的效果,他用的是Shadowmap实现的阴影,但他自己都坦言:“在GeForce-7300GT上,最多画4个光源,再多就变幻灯片了,而且模型数量不能太多。”http://blog.youkuaiyun.com/lv_ximing/archive/2010/07/27/5766569.aspx)。

    因为这个问题,我纠结了很长时间,DS算法说起来是比较简单,空间换时间。可为什么大部分相关文章在谈到DS的优点的时候,都说可以实现多动态光源,去很少提到阴影的具体实现方法,好像阴影是理所当然的事。

   《GPU精粹2》中有一篇文章《S.T.A.L.K.E.R.中的延期着色(Deferred Shading in S.T.A.L.K.E.R.)》,其中介绍的阴影也是用shadowmap来实现的。

   《GPU精粹3》中有一篇专门的介绍延迟渲染的,《Tabula Rasa中的延迟着色技术》,其实网上就有这篇文章的翻译:(“天堂里的死神”童鞋很给力,《GPU精粹3》的中文版是10年6月才出版的,他09年就翻译了这篇文章。)http://blog.youkuaiyun.com/noslopforever/archive/2009/03/04/3951273.aspx ,在Tabula Rasa中,阴影也是用shadowmap实现的。他还有一篇相关的博客《“杀戮地带2”中的延迟渲染》http://blog.youkuaiyun.com/noslopforever/archive/2009/09/21/4577327.aspx,《Killzone 2》中也是用的shadowmap来实现的。

   这么多的经典游戏中都是用的shadowmap,看来shadowmap是比较好的选择了。不过也有文章提到用DS实现阴影体渲染的,最后将会附上原文,但没有使用多个光源,如果真的有多个动态光源,估计计数量也够呛。

    好了,开题的事就基本定下来了,题目就定为“多光源动态光照的实时渲染”之类的吧,反正是基于延迟渲染的,即使实现了延迟渲染之后,想进一步做Deferred Lighting和Inferred Lighting,也在题目范围之内。也算了了一大心事了,开题报告就好说了。此事告一段落,等导师让我们准备开题答辩时,再写开题报告吧。从此可以全心地准备找实习了,腾讯5月8来来汉笔试,期待中。希望能去游戏开发岗位实习。

    这是《OpenGL Shading Language(2nd Edition)》第13章的一节,讲的是用延迟渲染实现阴影体。(最近比较忙,时间有限,我只把这篇文章中基本关键部分翻译出来了的,水平有限,仅供参考。)

 

13.3. Deferred Shading for Volume Shadows

With contributions by Hugh Malan and Mike Weiblen

One of the disadvantages of shadow mapping as discussed in the previous section is that the performance depends on the number of lights in the scene that are capable of casting shadows. With shadow mapping, a rendering pass must be performed for each of these light sources. These shadow maps are utilized in a final rendering pass. All these rendering passes can reduce performance, particularly if a great many polygons are to be rendered.

It is possible to do higher-performance shadow generation with a rendering technique that is part of a general class of techniques known as DEFERRED SHADING. With deferred shading, the idea is to first quickly determine the surfaces that will be visible in the final scene and apply complex and time-consuming shader effects only to the pixels that make up those visible surfaces. In this sense, the shading operations are deferred until it can be established just which pixels contribute to the final image. A very simple and fast shader can render the scene into an offscreen buffer with depth buffering enabled. During this initial pass, the shader stores whatever information is needed to perform the necessary rendering operations in subsequent passes. Subsequent rendering operations are applied only to pixels that are determined to be visible in the high-performance initial pass. This technique ensures that no hardware cycles are wasted performing shading calculations on pixels that will ultimately be hidden.

To render soft shadows with this technique, we need to make two passes. In the first pass, we do two things:

   1. We use a shader to render the geometry of the scene without shadows or lighting into the frame buffer. 用一个着色器把场景中除了阴影和光照之外的几何形状信息到渲染到帧缓存中。

   2.  We use the same shader to store a normalized camera depth value for each pixel in a separate buffer. (This separate buffer is accessed as a texture in the second pass for the shadow computations.) 用同一个着色器把每个像素点的规一化照相机深度值存到一个单独的缓存中。(在阴影计算的第二个Pass中,这个单独缓存将会当作一张纹理。)

In the second pass, the shadows are composited with the existing contents of the frame buffer. To do this compositing operation, we render the shadow volume (i.e., the region in which the light source is occluded) for each shadow casting object. In the case of a sphere, computing the shadow volume is relatively easy. The sphere's shadow is in the shape of a truncated cone, where the apex of the cone is at the light source. One end of the truncated cone is at the center of the sphere (see Figure 13.2). (It is somewhat more complex to compute the shadow volume for an object defined by polygons, but the same principle applies.)

Figure 13.2. The shadow volume for a sphere

 

We composite shadows with the existing geometry by rendering the polygons that define the shadow volume. This allows our second pass shader to be applied only to regions of the image that might be in shadow. 通过渲染定义阴影体的多边形,我们把阴影与现有的几何信息合成。这可以让我们执行第二个pass的着色器仅仅只对图像上那些可能处在阴影中的区域进行渲染。

To draw a shadow, we use the texture map shown in Figure 13.3. This texture map expresses how much a visible surface point is in shadow relative to a shadow-casting object (i.e., how much its value is attenuated) based on a function of two values: 1) the squared distance from the visible surface point to the central axis of the shadow volume, and 2) the distance from the visible surface point to the center of the shadow-casting object. The first value is used as the s coordinate for accessing the shadow texture, and the second value is used as the t coordinate. The net result is that shadows are relatively sharp when the shadow-casting object is very close to the fragment being tested and the edges become softer as the distance increases.

Figure 13.3. A texture map used to generate soft shadows

 

In the second pass of the algorithm, we do the following:

在算法的第二个pass中,我们做如下的操作:

  1.  Draw the polygons that define the shadow volume. Only the fragments that could possibly be in shadow are accessed during this rendering operation. 画定义阴影体的多边形。在这次渲染操作中,只有那些可能处在阴影中的像素受影响。

  2.  For each fragment rendered,对每一个渲染的像素,

        a.  Look up the camera depth value for the fragment as computed in the first pass. 查询些像素在第一个pass中计算出的照相机深度值。

        b. Calculate the coordinates of the visible surface point in the local space of the shadow volume. In this space, the z axis is the axis of the shadow volume and the origin is at the center of the shadow-casting object. The x component of this coordinate corresponds to the distance from the center of the shadow-casting object and is used directly as the second coordinate for the shadow texture lookup. 在阴影体的局部空间内,计算可见面的点的坐标。在此空间中,Z轴是阴影体的轴线,原点在被投影物体的中心。些坐标的X分量对应着该点到被投影物体的中心的的距离,它可以直接用作查找阴影纹理时的第二个坐标。

       c. Compute the squared distance between the visible surface point and the z axis of the shadow volume. This value becomes the first coordinate for the texture lookup. 计算可见面上点到阴影体的Z轴的距离的平方。这个值将会作为查找阴影纹理时的第一个坐标。

         d. Access the shadow texture by using the computed index values to retrieve the light attenuation factor and store this in the output fragment's alpha value. The red, green, and blue components of the output fragment color are each set to 0. 用前面计算出的索引值从阴影纹理中读取光照衰减因子,并把它存在输出像素的alpha值中。把输出像素的R,G,B分量分别设为0。

       e. Compute for the fragment the light attenuation factor that will properly darken the existing frame buffer value. For the computation, enable fixed functionality blending, set the blend mode source function to GL_SRC_ALPHA, and set the blend destination function to GL_ONE. 计算像素的光照衰减因子,它可能使现有的帧缓存中的值变暗。计算时,打开固定功能混合,设置混合模式源函数为GL_SRC_ALPHA,设置混合目标函数为GL_ONE。

Because the shadow (second pass) shader is effectively a 2D compositing operation, the texel it reads from the depth texture must exactly match the pixel in the framebuffer it affects. So the texture coordinate and other quantities must be bilinearly interpolated without perspective correction. We interpolate by ensuring that w is constant across the polygondividing x, y, and z by w and then setting w to 1.0 does the job. Another issue is that when the viewer is inside the shadow volume, all faces are culled. We handle this special case by drawing a screen-sized quadrilateral since the shadow volume would cover the entire scene.

13.3.1. Shaders for First Pass

The shaders for the first pass of the volume shadow algorithm are shown in Listings 13.8 and 13.9. In the vertex shader, to accomplish the standard rendering of the geometry (which in this specific case is all texture mapped), we just call ftransform and pass along the texture coordinate. The other lines of code compute the normalized value for the depth from the vertex to the camera plane. The computed value, CameraDepth, is stored in a varying variable so that it can be interpolated and made available to the fragment shader.

To render into two buffers by using a fragment shader, the application must call glDrawBuffers and pass it a pointer to an array containing symbolic constants that define the two buffers to be written. In this case, we might pass the symbolic constant GL_BACK_LEFT as the first value in the array and GL_AUX0 as the second value. This means that gl_FragData[0] will be used to update the value in the soon-to-be-visible framebuffer (assuming we are double-buffering) and the value for gl_FragData[1] will be used to update the value in auxiliary buffer number 0. Thus,the fragment shader for the first pass of our algorithm contains just two lines of code (Listing 13.9).

Listing 13.8. Vertex shader for first pass of soft volume shadow algorithm

uniform vec3     CameraPos;

 uniform vec3     CameraDir;

 uniform float DepthNear;

 uniform float DepthFar;

 

 varying float CameraDepth;   // normalized camera depth

 varying vec2 TexCoord;

 

void main()

 {

      // offset = vector to vertex from camera's position

      vec3 offset = (gl_Vertex.xyz / gl_Vertex.w) - CameraPos;

 

      // z = distance from vertex to camera plane

      float z = -dot(offset, CameraDir);

 

      // Depth from vertex to camera, mapped to [0,1]

      CameraDepth = (z - DepthNear) / (DepthFar - DepthNear);

 

      // typical interpolated coordinate for texture lookup

      TexCoord = gl_MultiTexCoord0.xy;

 

      gl_Position = ftransform();

 }

 

 

Listing 13.9. Fragment shader for first pass of soft volume shadow algorithm

 uniform sampler2D TextureMap;

 

 varying float CameraDepth;

 varying vec2     TexCoord;

 

 void main()

 {

      // draw the typical textured output to visual framebuffer

      gl_FragData[0] = texture2D(TextureMap, TexCoord);

 

      // write "normaliized vertex depth" to the depthmap's alpha.

      gl_FragData[1] = vec4(vec3(0.0), CameraDepth);

 }

13.3.2. Shaders for Second Pass

The second pass of our shadow algorithm is responsible for compositing shadow information on top of what has already been rendered. After the first pass has been completed, the application must arrange for the depth information rendered into auxiliary buffer 0 to be made accessible for use as a texture. There are several ways we can accomplish this. One way is to set the current read buffer to auxiliary buffer 0 by calling glReadBuffer with the symbolic constant GL_AUX0, and then call glCopyTexImage2d to copy the values from auxiliary buffer 0 to a texture that can be accessed in the second pass of the algorithm. (A higher performance method that avoids an actual data copy is possible if the EXT_framebuffer_objects extension is used. This extension is expected to be promoted to the OpenGL core in OpenGL 2.1.)

In the second pass, the only polygons rendered are the ones that define the shadow volumes for the various objects in the scene. We enable blending by calling glEnable with the symbolic constant GL_BLEND, and we set the blend function by calling glBlendFunc with a source factor of GL_ONE and a destination factor of GL_SRC_ALPHA. The fragment shader outputs the shadow color and an alpha value obtained from a texture lookup operation. This alpha value blends the shadow color value into the frame buffer.

The vertex shader for the second pass (see Listing 13.10) is responsible for computing the coordinates for accessing the depth values that were computed in the first pass. We accomplish the computation by transforming the incoming vertex position, dividing the x, y, and z components by the w component, and then scaling and biasing the x and y components to transform them from the range [1,1] into the range [0,1]. Values for ShadowNear and ShadowDir are also computed. These are used in the fragment shader to compute the position of the fragment relative to the shadow-casting object.

 

Listing 13.10. Vertex shader for second pass of soft volume shadow algorithm

 

 uniform mat3 WorldToShadow;

 uniform vec3 SphereOrigin;

 

 uniform vec3 CameraPos;

 uniform vec3 CameraDir;

 uniform float DepthNear;

 uniform float DepthFar;

 

 varying vec2 DepthTexCoord;

 varying vec3 ShadowNear;

 varying vec3 ShadowDir;

 

 void main()

 {

      vec4 tmp1 = ftransform();

      gl_Position = tmp1;

 

      // Predivide out w to avoid perspective-correct interpolation.

      // The quantities being interpolated are screen-space texture

      // coordinates and vectors to the near and far shadow plane,

      // all of which have to be bilinearly interpolated.

      // This could potentially be done by setting glHint,

      // but it wouldn't be guaranteed to work on all hardware.

 

      gl_Position.xyz /= gl_Position.w;

      gl_Position.w = 1.0;

 

      // Grab the transformed vertex's XY components as a texcoord

      // for sampling from the depth texture from pass 1.

      // Normalize them from [0,0] to [1,1]

 

      DepthTexCoord = gl_Position.xy * 0.5 + 0.5;

 

      // offset = vector to vertex from camera's position

      vec3 offset = (gl_Vertex.xyz / gl_Vertex.w) - CameraPos;

 

      // z = distance from vertex to camera plane

      float z = -dot(offset, CameraDir);

 

      vec3 shadowOffsetNear = offset * DepthNear / z;

      vec3 shadowOffsetFar      = offset * DepthFar / z;

 

      vec3 worldPositionNear = CameraPos + shadowOffsetNear;

      vec3 worldPositionFar      = CameraPos + shadowOffsetFar;

 

      vec3 shadowFar     = WorldToShadow * (worldPositionFar - SphereOrigin);

      ShadowNear = WorldToShadow * (worldPositionNear - SphereOrigin);

      ShadowDir = shadowFar - ShadowNear;

 }

The fragment shader for the second pass is shown in Listing 13.11. In this shader, we access the cameraDepth value computed by the first pass by performing a texture lookup. We then map the fragment's position into the local space of the shadow volume. The mapping from world to shadow space is set up so that the center of the occluding sphere maps to the origin, and the circle of points on the sphere at the terminator between light and shadow maps to a circle in the YZ plane.

The variables d and l are respectively the distance along the shadow axis and the squared distance from it. These values are used as texture coordinates for the lookup into the texture map defining the shape of the shadow.

With the mapping described above, points on the terminator map to a circle in the YZ plane. The texture map has been painted with the transition from light to shadow occurring at s=0.5; to match this, the mapping from world to shadow is set up so that the terminator circle maps to a radius of sqrt(0.5).

Finally, the value retrieved from the shadow texture is used as the alpha value for blending the shadow color with the geometry that has already been rendered into the frame buffer.

Listing 13.11. Fragment shader for second pass of soft volume shadow algorithm

 

 uniform sampler2D DepthTexture;

 uniform sampler2D ShadowTexture;

 

 varying vec2 DepthTexCoord;

 varying vec3 ShadowNear;

 varying vec3 ShadowDir;

 

 const vec3 shadowColor = vec3(0.0);

 

 void main()

  {

      // read from DepthTexture

      // (depth is stored in texture's alpha component)

      float cameraDepth = texture2D(DepthTexture, DepthTexCoord).a;

 

      vec3 shadowPos = (cameraDepth * ShadowDir) + ShadowNear;

      float l = dot(shadowPos.yz, shadowPos.yz);

      float d = shadowPos.x;

 

      // k = shadow density: 0=opaque, 1=transparent

      // (use texture's red component as the density)

      float k = texture2D(ShadowTexture, vec2(l, d)).r;

 

      gl_FragColor = vec4(shadowColor, k);

  }

Figure 13.4 shows the result of this multipass shading algorithm in a scene with several spheres. Note how the shadows for the four small spheres get progressively softer edges as the spheres increase in distance from the checkered floor. The large sphere that is farthest from the floor casts an especially soft shadow.

Figure 13.4. Screen shot of the volume shadows shader in action.

   Notice that spheres that are farther from the surface have shadows with softer edges.

 

The interesting part of this deferred shading approach is that the volumetric effects are implemented by rendering geometry that bounds the volume of the effect. This almost certainly means processing fewer vertices and fewer fragments. The shaders required are relatively simple and quite fast. Instead of rendering the geometry once for each light source, the geometry is rendered just once, and all the shadow volumes due to all light sources can be rendered in a single compositing pass. Localized effects such as shadow maps, decals, and projective textures can be accomplished easily. Instead of having to write tricky code to figure out the subset of the geometry to which the effect applies, you write a shader that is applied to each pixel and use that shader to render geometry that bounds the effect. This technique can be extended to render a variety of different effectsvolumetric fog, lighting, and improved caustics to name a few.

 

 

微信小程序AI象棋开发指南:规则引擎与算法实现 游戏AI开发是当前移动应用的热门技术方向,其中基于minimax算法的决策系统在棋类游戏中应用广泛。该算法通过模拟未来走法并结合alpha-beta剪枝优化,能有效平衡计算复杂度与智能水平。在微信小程序这类轻量级平台中,开发者需特别注意性能优化,例如采用canvas渲染、WebWorker多线程计算等技术方案。象棋作为中国传统策略游戏,其规则引擎的实现涉及棋子移动校验、胜负判定等核心逻辑,而AI模块的难度分级则可通过调整搜索深度来控制。这类技术组合不仅能用于象棋小程序开发,也可拓展至其他棋牌类、教育类应用场 阅读详情

相关推荐

OpenGL延迟渲染:实现延迟阴影效果

延迟渲染(Deferred Rendering)是一种在实时渲染中常用的技术,它可以有效地处理大量的光源和复杂的材质。通过建立渲染管线、渲染几何信息、计算和应用光照效果,我们可以达到更真实的场景渲染效果。在这个通道中,我们将渲染场景的几何信息到一个称为G缓冲(G-buffer)的纹理中。在光照通道中,我们将使用G缓冲中的几何信息来计算和应用光照效果。在这个通道中,我们将使用G缓冲中的几何信息来计算光照的贡献,并将结果存储在帧缓冲中。最后,我们可以使用计算得到的阴影值来调整光照的贡献,从而实现延迟阴影效果。

SVIPCODE的博客 417

Light index must be a valid shadow casting light——解决大法GetShadowCasterBounds

GetShadowCasterBounds这个方法可以解决。 出现这个错误的原因是,当前灯光没有照射任何物体,但是依然进行了shadowmap的绘制会导致这个错误。 if (!m_cullingResults.GetShadowCasterBounds(visibleIndex, out Bounds b)) { m_otherLightsShadowData[index] = new Vector4(-light.shadowStrength, 0, 0, maskChannel); r.

小孔明的专栏 967

保姆级教程:用中移ML307模组对接高德/OneOS定位服务,从配置apikey到解析+MLBSLOC状态码

本文详细介绍了如何使用中移ML307系列模组对接高德/OneOS定位服务,从配置apikey到解析+MLBSLOC状态码的全过程。涵盖高德定位服务和OneOS定位服务的配置步骤、常见错误处理及性能优化技巧,帮助开发者快速实现基站定位功能,提升物联网项目的定位精度和稳定性。

weixin_30632089的博客 508

延迟渲染(Deferred Rendering)

什么是延迟渲染?( Deferred Rendering) 在计算机图形学中,延迟渲染( Deferred Rendering) ,即延迟着色(Deferred Shading),是将着色计算延迟到深度测试之后进行处理的一种渲染方法。延迟着色技术的最大的优势就是将光源的数目和场景中物体的数目在复杂度层面上完全分开,能够在渲染拥有成百上千光源的场景的同时依然保持很高的帧率,给我们渲染拥有大量光源的场...

菜鸡工坊 6333

3D Gaussian Splatting:用于实时的辐射场渲染

3D Gaussian Splatting:用于实时的辐射场渲染 3d gaussian splatting for real-time radiance field rendering

m0_51976564的博客 1万+

XS5018A TX ISP芯片同轴高清模拟输出图像处理芯片用户指南

当看门狗开启且系统异常,看门狗模块得不到喂狗信号时,自动产生看门狗复位信号,复位​​​​​​​。分量上与人眼对光谱的响应通常是有偏差的,通常通过一个色彩校正矩阵校正光谱响应的交叉效。但实际上由于电路的作用,复位模块对整个芯片及各个功能模块的复位进行统一管理,负责产生各个模块的软复位信。每个区域前景色可以在 16 个色表中查找,单个区域的前景色统一,各个区域的前。较弱的坏点被放大成刺眼的白点和明显的黑点,强烈推荐开启动态坏点校正功能。四种制式,通过寄存器配置,可以很方便的实现四种制式的切换、且可以对截止。

2403_88922712的博客 1961

思考:延迟渲染与 Z-PRE PASS的区别

待总结

c1sdn19的专栏 764

开关电源EMI优化秘籍:三明治绕法如何让你的产品通过认证测试

本文深入解析了开关电源EMI优化中的三明治绕法,详细阐述了其通过改变绕组排布来减小初次级寄生电容、降低共模噪声的核心机理。文章提供了从绕制结构选择、绝缘安规处理到实测验证的全流程实战指南,帮助工程师有效利用这一工艺,提升产品通过CCC、CE等EMI认证测试的成功率。

tcp8optimizer的博客 706

Nanbeige 4.1-3B WebUI参数详解:流式输出延迟、气泡样式、折叠阈值设置

本文介绍了如何在星图GPU平台上自动化部署🌸 Nanbeige 4.1-3B Streamlit WebUI (极简清爽版)镜像,并详细解析了其核心参数设置。该镜像提供了一个极简、美观的AI对话界面,用户可通过调整流式输出延迟、聊天气泡样式及思考过程折叠阈值等参数,优化对话体验,适用于日常AI聊天、内容创作辅助等场景。

weixin_28681379的博客 426

学习海康VisionMaster之BLOB分析

6):软阈值(相对):是一种动态阈值分割方法,其核心思想是 基于图像局部特性(如背景或参考区域)自适应调整阈值范围,适用于光照变化明显、背景灰度不均的场景。3:拖入位置修正功能:这个非常重要,模版匹配成功后会得到新的匹配坐标,那和创建模版时候的原点坐标会组合成一个坐标变换矩阵,通过这个矩阵,那后续的blob分析窗口则可以实现精确定位来查找目标对象。(2):设定参数:这里阈值方式是blob的核心算法,根据不同的应用场景来选择不同的阈值方式。8:高级参数:是设定blob区域的特征范围,用于筛选出来特定的区域。

yuhouxiyang的专栏 3620

深度学习技巧应用26-CNN中多种注意力机制的嵌入方法,终于搞懂注意力机制了

大家好,我是微学AI,今天给大家介绍一下深度学习技巧应用26-CNN中多种注意力机制的嵌入方法,终于搞懂注意力机制了。CNN是一种能够有效处理图像和其他二维数据的深度学习模型。在传统的CNN中,每个卷积核都会对输入的所有位置进行相同的操作,这可能导致网络无法针对特定区域或特征进行更加关注和重点处理。 注意力机制被引入卷积神经网络中,旨在使网络能够自动地学习和聚焦于输入中的重要区域或特征。通过引入注意力机制,可以增强网络对不同区域或特征的关注度,提取更有意义和相关的特征,从而提高模型的性能和表达能力。

微学AI的博客 3313

ollama调用QwQ-32B的WebSocket流式接口:支持浏览器端实时思考链渲染

本文介绍了如何在星图GPU平台上自动化部署【ollama】QwQ-32B镜像,实现基于WebSocket的流式推理接口。该方案支持在浏览器端实时渲染大语言模型的思考链,典型应用于复杂问题的逐步推理和逻辑分析场景,显著提升交互体验与模型透明度。

weixin_31163455的博客 354

超强干货之---Python-数据爬取(爬虫)

定义: 深度优先搜索是一种遍历或搜索树或图的算法,从起始节点开始,一直沿着一个分支走到底,再回溯到上一个节点继续搜索下一个分支,直到遍历完所有节点。特点递归:通常用递归实现,或者使用栈来模拟递归过程。内存占用低:在有大量分支的情况下,内存占用比广度优先搜索低。适合目标较深的情况:如果目标节点距离起始节点较深,DFS能更快找到目标。适用场景需要遍历所有节点的情况,如生成树、迷宫搜索。目标节点较深,且分支较多时。在大规模数据爬取时,选择合适的存储方式取决于数据的规模、结构和访问需求。

房东的猫的博客 5万+

Nanbeige 4.1-3B效果实测:思考链可视化+像素光标动态渲染

本文介绍了如何在星图GPU平台上自动化部署🎮 Nanbeige 4.1-3B: 像素冒险聊天终端镜像,打造游戏化AI对话体验。该镜像通过像素风格界面和思考链可视化功能,特别适用于创意写作辅助场景,让用户直观看到AI生成故事剧情的完整推理过程,同时享受复古游戏的交互乐趣。

weixin_26854475的博客 158

Android/Linux驱动开发:使用dev_dbg进行设备驱动调试

在本文中,我们将介绍如何使用dev_dbg宏和相关的函数来进行设备驱动调试。函数在该目录下创建了一个名为"debug"的debugfs文件。在这些函数中,您可以执行与您的设备驱动相关的调试操作。函数在该目录下创建了一个名为"debug"的debugfs文件。在这些函数中,您可以执行与您的设备驱动相关的调试操作。的结构体指针,其中包含了我们定义的文件操作函数。的结构体指针,其中包含了我们定义的文件操作函数。在上面的示例中,我们首先通过调用。在上面的示例中,我们定义了。在上面的示例中,我们定义了。

ByteKnight的博客 373

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Nanbeige 4.1-3B实战教程:WebSocket升级支持长连接+实时思考流推送

本文介绍了如何在星图GPU平台上自动化部署🎮 Nanbeige 4.1-3B: 像素冒险聊天终端镜像,实现WebSocket长连接与实时思考流推送功能。该方案特别适用于游戏化AI对话场景,通过持久化连接和模型推理过程可视化,显著提升交互体验与响应速度,是教育、娱乐等领域的理想选择。

weixin_42593130的博客 315

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Nanbeige 4.1-3B极简界面实测:丝滑流式输出,思考过程智能折叠

本文介绍了如何在星图GPU平台上自动化部署🌸 Nanbeige 4.1-3B Streamlit WebUI (极简清爽版)镜像,实现流畅的大模型对话交互体验。该镜像通过极简设计和智能折叠功能,将复杂的模型思考过程转化为类似手机聊天的自然界面,适用于本地AI对话、内容创作等场景,显著提升用户交互效率。

weixin_33816734的博客 105

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

门店导购数字人落地实战:魔珐星云重构线下零售可交互服务体验

大模型赋予 AI 推理思考能力,但线下门店想要自然沟通,必须搭载完整具身交互智能,让 AI 拥有具象载体、实时语音、同步神态与双向倾听能力。

todoitbo的博客 1万+

ChatGLM3-6B Streamlit流式输出效果:支持思考链(CoT)逐步展示

本文介绍了如何在星图GPU平台上自动化部署🤖 ChatGLM3-6B镜像,构建一个支持思考链(CoT)流式输出的智能对话应用。该应用能将模型处理复杂问题(如逻辑推理、代码生成)时的内部推理过程逐步、实时地展示出来,极大地提升了人机交互的透明度和可学习性。

weixin_42168902的博客 138

Nanbeige 4.1-3B惊艳效果:思考日志中自动高亮关键词的像素荧光笔效果

本文介绍了如何在星图GPU平台上自动化部署🎮 Nanbeige 4.1-3B: 像素冒险聊天终端镜像,实现AI对话中的思考日志关键词自动高亮功能。该镜像通过独特的像素荧光笔效果,将模型推理过程可视化,特别适用于教育、开发者调试等场景,提升AI交互的透明度和趣味性。

weixin_36235398的博客 202

虚拟滚动列表和css虚拟滚动【有思考】

我所理解的是,虚拟滚动需要一次性获取所有数据,但是只渲染显示屏幕可见范围内的那些。要做到这些我需要知道:假设一次只需要展示 10 条数据,需要加载的数据是一个数组,只需要裁剪数据范围随着滚动条向下,将可以计算出当前行数。 而要模拟滚动条高度就要在页面挂载时就手动设置页面的高度为。 最后也是最关键的是保持列表一直保持在当前位置上,手动设置列表容器等于当前滚动条高度。 如何使用? CSS虚拟滚动 这个概念忘了在哪听到的了。其实我认为它更像是一种内容的懒加载。 他需要用到一个css属性::控制一个元素是否渲染其内

flying meng的菜鸟居 2528

通义千问1.5-1.8B-Chat-GPTQ-Int4 Chainlit交互效果展示:流式输出+思考过程可视化

本文介绍了如何在星图GPU平台自动化部署通义千问1.5-1.8B-Chat-GPTQ-Int4镜像,实现高效的AI对话应用。该镜像通过流式输出和思考过程可视化,特别适用于代码助手、教育辅助等场景,提升交互透明度和用户体验。

weixin_36303807的博客 290

Nanbeige 4.1-3B惊艳效果:流式渲染速度与显存占用的帕累托最优解

本文介绍了如何在星图GPU平台上自动化部署🎮 Nanbeige 4.1-3B: 像素冒险聊天终端镜像,打造复古像素风AI对话体验。该镜像通过流式渲染架构和显存优化技术,实现高效响应与低资源占用,特别适用于游戏剧情创作、技术问答等交互场景,为用户带来独特的JRPG风格对话体验。

weixin_35045970的博客 193
上一篇: 顺便去淘宝霸笔了
下一篇: 上穷碧落下黄泉,源码追踪经验谈——侯捷
未来信使
博客等级 码龄19年 23粉丝 17原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值