Use of Lightmap in Unity3d

Source: Internet
Author: User


Environment: unity3d4.1,windows8.1

Unity3d can produce better illumination maps, and using them in a program can produce better results.

First, the illumination map offset is obtained

Renderer.lightmaptilingoffset Illumination Map Tiling offset
Description description
The tiling & offset used for lightmap. Tile and offset values for the lighting map.


A scene can has several lightmaps stored in it, and Renderer can use one of the those lightmaps.This makes it possible to use the same material on multiple objects, while each object can refer to a different lightmap O R different portion of the same lightmap.

A scene can store multiple light maps, and the renderer can use one of these lighting maps. This makes it possible to use the same material in multiple objects, although each object can refer to different light maps or different parts of the same light.

The vector ' s X and y refers to the lightmap scale, while Z and W refers to the Lightmap offset.

The vector's X and y are attributed to the scale of the illumination map, and Z and W are the offsets of the illumination map.

Second, light map

The code for the light map is as follows:

GLTEXCOORD2F (u1*x + z, v1*y + W); glvertex3f ( -2.0f, -2.0f, 0.0f); GLTEXCOORD2F (u2*x + z, v2*y + W); glvertex3f ( -2.0f, 2.0f, 0.0f); GLTEXCOORD2F (u3*x + z, v3*y + W); glvertex3f (2.0f, 2.0f, 0.0f); GLTEXCOORD2F (u4*x + z, v4*y + W); glvertex3f (2.0f, -2.0f, 0.0f);
The above UI and vi are texture coordinates that can be obtained through the uv2 of the mesh.


Use of Lightmap in Unity3d

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.