Add a good default UV map to our 'monkey' primitive. #47488

Closed
opened 2016-02-19 12:17:24 +01:00 by Bastien Montagne · 24 comments

We now have the option when creating a new mesh primitive to add a default UV map - but the monkey head has none currently.

This map cannot be procedurally generated like the other, once agreed on it should be hard-coded into the code, in a similar way to how the monkey geometry already is.

This project has 2 parts:

  • Create the new UV layout.
  • Add a fixed UV layout as an option for this primitive (see related commit 3c6709a63c)
We now have the option when creating a new mesh primitive to add a default UV map - but the monkey head has none currently. This map cannot be procedurally generated like the other, once agreed on it should be hard-coded into the code, in a similar way to how the monkey geometry already is. This project has 2 parts: - Create the new UV layout. - Add a fixed UV layout as an option for this primitive (see related commit 3c6709a63c)
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'
Author
Owner

Added subscriber: @mont29

Added subscriber: @mont29

Added subscriber: @abhishek12123

Added subscriber: @abhishek12123

Removed subscriber: @abhishek12123

Removed subscriber: @abhishek12123

Added subscriber: @amdbcg

Added subscriber: @amdbcg

Who wants to go first? how are these UVs supposed to be generated? Should I put together seams around the eyes , mouth, ears, and get feedback from that?

Who wants to go first? how are these UVs supposed to be generated? Should I put together seams around the eyes , mouth, ears, and get feedback from that?

Added subscriber: @major_rascal

Added subscriber: @major_rascal

hi, i wanted to make my first contribution to blender , i know about uv mapping and coding (c++) ...could i be of any help :)

hi, i wanted to make my first contribution to blender , i know about uv mapping and coding (c++) ...could i be of any help :)

Added subscriber: @ideasman42

Added subscriber: @ideasman42

If anyone likes to work on this, just go ahead, no need to ask first.
Check 3c6709a63c which adds UV's to other primitives (a useful reference to see related code).

If anyone likes to work on this, just go ahead, no need to ask first. Check 3c6709a63c which adds UV's to other primitives (a useful reference to see related code).

Added subscriber: @ChauHo

Added subscriber: @ChauHo

Youtube video from Mysticduder have nice mesh pattern below. I people like this pattern I will make it symmetric and get coordinate for all points. Please tell me your ideas about it. Thaks!ConKỷ.png

Youtube video from Mysticduder have nice mesh pattern below. I people like this pattern I will make it symmetric and get coordinate for all points. Please tell me your ideas about it. Thaks!![ConKỷ.png](https://archive.blender.org/developer/F319921/ConKy_.png)

Added subscriber: @pdlla

Added subscriber: @pdlla
peter lu self-assigned this 2016-08-26 20:12:57 +02:00

Hi, first time here. I'm assuming no one is working on this anymore? I'm giving this a shot :). Will also look into fixing default unwrap for the UV sphere. Someone on IRC mentioned it "looks like a truck ran over it" and suggested I start there. I didn't see a tasks for this though.

Hi, first time here. I'm assuming no one is working on this anymore? I'm giving this a shot :). Will also look into fixing default unwrap for the UV sphere. Someone on IRC mentioned it "looks like a truck ran over it" and suggested I start there. I didn't see a tasks for this though.

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

In #47488#388098, @pdlla wrote:
Hi, first time here. I'm assuming no one is working on this anymore? I'm giving this a shot :). Will also look into fixing default unwrap for the UV sphere. Someone on IRC mentioned it "looks like a truck ran over it" and suggested I start there. I didn't see a tasks for this though.

There is a task were the UV sphere is mentioned. It's #47478

> In #47488#388098, @pdlla wrote: > Hi, first time here. I'm assuming no one is working on this anymore? I'm giving this a shot :). Will also look into fixing default unwrap for the UV sphere. Someone on IRC mentioned it "looks like a truck ran over it" and suggested I start there. I didn't see a tasks for this though. There is a task were the UV sphere is mentioned. It's #47478

Here is high resolution map with symmetry for monkey head. Please tell me your ideas guys. If happy with this I will finish clean up and list coordinates for all points.
PNG file:
ConKỷ.png

SVG file (Inkscape):
ConKỷ.svg

Here is high resolution map with symmetry for monkey head. Please tell me your ideas guys. If happy with this I will finish clean up and list coordinates for all points. PNG file: ![ConKỷ.png](https://archive.blender.org/developer/F354074/ConKy_.png) SVG file (Inkscape): ![ConKỷ.svg](https://archive.blender.org/developer/F354076/ConKy_.svg)

In #47488#390117, @ChauHo wrote:
Here is high resolution map with symmetry for monkey head. Please tell me your ideas guys. If happy with this I will finish clean up and list coordinates for all points.
PNG file:
ConKỷ.png

SVG file (Inkscape):
ConKỷ.svg

Do you happen to have an screen cap of the seams that generated that map? (assuming it was done using unwrap in Blender)

> In #47488#390117, @ChauHo wrote: > Here is high resolution map with symmetry for monkey head. Please tell me your ideas guys. If happy with this I will finish clean up and list coordinates for all points. > PNG file: > ![ConKỷ.png](https://archive.blender.org/developer/F354074/ConKy_.png) > > SVG file (Inkscape): > ![ConKỷ.svg](https://archive.blender.org/developer/F354076/ConKy_.svg) Do you happen to have an screen cap of the seams that generated that map? (assuming it was done using unwrap in Blender)

I get pattern from this video from Mystic Duder:
https://www.youtube.com/watch?v=vu2jZwRmz1o

Blend. file with seams:
conKỷ.blend

I get pattern from this video from Mystic Duder: https://www.youtube.com/watch?v=vu2jZwRmz1o Blend. file with seams: [conKỷ.blend](https://archive.blender.org/developer/F354396/conKy_.blend)

@ChauHo

Thanks! I'm using these UVs now.

Screen Shot 2016-09-08 at 10.43.22 AM.png


I modified the unwrap operation to output its UVs for the purpose of hardcoding Suzanne's UV map. I pasted the code below for my own reference since it's not something that should be in the code base.

(oddly enough, since the UVs are already there, I output them before the actual unwrapping, which makes the fact that this is in the unwrap function pretty arbitrary)

static int unwrap_exec(bContext *C, wmOperator *op){
...
    BMesh* bm = em->bm;
    const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
    BMFace *f;
    BMIter iter,iter2;
    int find = 0;
    BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
        BMLoop *l;
        int loop_index;
        int vind = 0;
        BM_ITER_ELEM_INDEX (l, &iter2, f, BM_LOOPS_OF_FACE, loop_index) {
            MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
            printf("%ff,%ff,",luv->uv[0],luv->uv[1]);
            vind++;
        }
        find++;
        printf("\n");
    }

@ChauHo Thanks! I'm using these UVs now. ![Screen Shot 2016-09-08 at 10.43.22 AM.png](https://archive.blender.org/developer/F356241/Screen_Shot_2016-09-08_at_10.43.22_AM.png) ----------------- I modified the unwrap operation to output its UVs for the purpose of hardcoding Suzanne's UV map. I pasted the code below for my own reference since it's not something that should be in the code base. (oddly enough, since the UVs are already there, I output them before the actual unwrapping, which makes the fact that this is in the unwrap function pretty arbitrary) ``` static int unwrap_exec(bContext *C, wmOperator *op){ ... BMesh* bm = em->bm; const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); BMFace *f; BMIter iter,iter2; int find = 0; BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BMLoop *l; int loop_index; int vind = 0; BM_ITER_ELEM_INDEX (l, &iter2, f, BM_LOOPS_OF_FACE, loop_index) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); printf("%ff,%ff,",luv->uv[0],luv->uv[1]); vind++; } find++; printf("\n"); } ```

This would be ready to go except the face or loop order of the monkey seems to change in the following conditions:

  • enter edit mode with a mesh that has many* UVs
  • delete some geometry with UVs
  • while still in edit mode, add Monkey
  • observe UVs are messed up.

*many here meaning > 20 tris but <= 60 tris and I know this because when adding deleting an icosphere with no subdivisions everything is ok, but breaks when subdividing once or more.

The weird part is I'm using the same code to generate the icosphere UVs and they work fine under the same conditions. The only difference is there are 20x 3 vertex faces in the icosphere versus 500x 3-4 vertex quads in the monkey.

To clarify, I have the monkey and icosphere UVs hardcoded. I iterate through each face of mesh and each loop of face and set the UVs when the primitives are created. The UVs are hard coded to this iteration order.

Well, I'll investigate more tomorrow. In the meantime, does anyone have any ideas? I'm getting the hang of how edit mode and bmeshes work but still overall pretty unfamiliar.

Screen Shot 2016-09-08 at 11.20.30 AM.png

This would be ready to go except the face or loop order of the monkey seems to change in the following conditions: - enter edit mode with a mesh that has many* UVs - delete some geometry with UVs - while still in edit mode, add Monkey - observe UVs are messed up. *many here meaning > 20 tris but <= 60 tris and I know this because when adding deleting an icosphere with no subdivisions everything is ok, but breaks when subdividing once or more. The weird part is I'm using the same code to generate the icosphere UVs and they work fine under the same conditions. The only difference is there are 20x 3 vertex faces in the icosphere versus 500x 3-4 vertex quads in the monkey. To clarify, I have the monkey and icosphere UVs hardcoded. I iterate through each face of mesh and each loop of face and set the UVs when the primitives are created. The UVs are hard coded to this iteration order. Well, I'll investigate more tomorrow. In the meantime, does anyone have any ideas? I'm getting the hang of how edit mode and bmeshes work but still overall pretty unfamiliar. ![Screen Shot 2016-09-08 at 11.20.30 AM.png](https://archive.blender.org/developer/F356252/Screen_Shot_2016-09-08_at_11.20.30_AM.png)

I set the UVs right after each face is created rather then after all faces are created and assuming the iteration order does not change. Apparently it does change in some circumstances. This works fine now in all conditions I tested it under but the code isn't quite as nice :(.

I set the UVs right after each face is created rather then after all faces are created and assuming the iteration order does not change. Apparently it does change in some circumstances. This works fine now in all conditions I tested it under but the code isn't quite as nice :(.

This issue was referenced by a070a5befa

This issue was referenced by a070a5befa1110120547333d84c6e67cae53d648

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#47488
No description provided.