Dai chou
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Texture mapping ###### tags: `course` `computer graphic` ## Texture mapping 在Fragment process做掉 ### problem - Aliasing artifacts - Requires special anti-aliasing treatments ## 2D-to-3D texture mapping area-to-area mapping in pipeline distortion ![](https://i.imgur.com/eZOMDlr.png) Pixel -> an area on surface -> an area on the texture. This is an area-to-area mapping. ### two-stage mapping #### Forward mapping ![](https://i.imgur.com/sqBGn7D.png) - **s-mapping**:maps from texture space to simple intermediate surface such as a cylinder or sphere > T(u,v) -> T'(x', y', z') > context-dependent > using cylinder,cube ,sphere - **o-mapping**:maps points on the intermediate surfce onto the object surface > T'(x',y',z') -> O(x,y,z) > 1. 先從觀察者視線投射(x,y,z)到平面後反射到cylinder找到(x',y',z') (environmental mapping > 2. 取suface上的點(x,y,z)的normal,到cylinder(x',y',z') (inverse mapping) > 3. 從物件中心centroid通過(x,y,z)到(x',y',z') (inverse mapping) > 4. 從T'(x',y',z')的normal到(x,y,z) > #### forward mapping and inverse mapping + forward mapping could have hole or overlaping in textures + Inverse mapping: good for z bufer (實物上常用) #### inverse mapping 1. Inverse map 4 pixel corners to 4 points (xw,yw,zw) on the object surface. 2. Apply O-mapping to find the point (,h) on the cylinder surface. In the shrinkwrap case, join the center of the cylinder to the object point (xw, yw, zw) and intersect this line with the cylinder surface. This gives us (x', y', z'). (,h) is obtained by (xw, yw, zw) -> (,h) = (tan-1 (yw / zw), zw) 3. Apply S-mapping to find (u,v) corresponding to (,h). ![](https://i.imgur.com/Di7NRA4.png) ![](https://i.imgur.com/UrxWQPq.png) #### Perspective-correct interpolation - affine texture mapping > 用深度當成內插的參數一部分 > ![](https://i.imgur.com/0hobBqS.png) ## Anti-aliasing + GL_NEAREST(找最近的texel) + GLLINER(相鄰四個texel做平均) + 都會有aliasing的問題 ### Antialiasing methods + Properly sum weighted values of texels inside the pre-image + Mip-mapping ### mip-mapping + Minification > When an object moves away and becomes small in screen a pixel has a larger pre-image in texture space (since texture is fixed), so many texels map into a single pixel. > A pixel maps onto many texels. + Magnification > When an object becomes close to the viewer and only part of it may occupy the whole screen, resulting in pixel pre-images that have less area than one texel. > A pixel maps onto less one texel. + **Mip,map** > A set of pre-filtered texture maps, each is exactly half the resolution of the previous one. Thus each texel in a low resolution map represents the average of a number of texels from the previous map. > 選擇最接近的兩個mip map先分別用GL_Nearest或是GL_Linear,然後做內插(因為mip map discontinuities) => two level > one level:如果只選到一個level用GL_Nearest或是GL_Linear interpolation來得到pixel's color > Tri-linear interpolation 結果 overblurring 邊緣扭曲 解法:Rectangular filtering (Rip map or summed-area table) Unconstrained anisotropic filtering (available in OpenGL) + Rip map > Images on diagonal are the mipmap subtextures. > Images in offdiagonal are other ripmap subtextures + Unconstrained anisotropic filtering (非等方性過濾) > https://www.geforce.com.tw/whats-new/guides/aa-af-guide#1 > ![](https://i.imgur.com/9hrW5n5.png) > + Back projection 4 corners of pixel onto texture > + Find the center line - Find the shorter side and longer side - Length of the shorter side determine the mipmap level used > > + Sample the mipmapped texture along the center line of longer sides according to the ratio of longer/shorter sides ## 3D Solid texture mapping ## Environment mapping + Reflecting a surrounding environment in a shiny object. + As a cheap alternative, we pre-store the surrounding environment as a map. + cheap + Two-stage mapping: 1. a view-independent map generation 2. a view-dependent mapping. ![](https://i.imgur.com/yWcahdi.png) ### map creation (view-independent) - Uses a box as an intermediate surface. - Takes six photographs, or rendering six maps - Spherical map suffers from distortion at poles. - Construct the **environment** map as usual. - Find the texture coordinate for each vertex using **inverse O-mapping (view-independent)** ### mapping operation(view-dependent) - **Fire four rays (from eye)** through the pixel’s corners, defining a reflection cone - Filter the region that subtends the in the environment map to give a single shaded attribute for the pixel. - ![](https://i.imgur.com/gdJ9QY6.png) - ![](https://i.imgur.com/qX66TA9.png) ## Bump map - 擾動表面Normal vector方向,但不改變實際形狀 - ![](https://i.imgur.com/N3vKNgL.png) - Two signed value (bu, bv) + To scale two vectors that are perpendicular to normal - A heightfield + To derive (bu, bv) and modify the normal’s direction > 透過(bu,bv)改變原本Normal > ![](https://i.imgur.com/DZcaVQ7.png) > ![](https://i.imgur.com/9n0eNWY.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully