﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AYiming%2FGSoC_2018%2FQuestions</id>
	<title>利用者:Yiming/GSoC 2018/Questions - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AYiming%2FGSoC_2018%2FQuestions"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Yiming/GSoC_2018/Questions&amp;action=history"/>
	<updated>2026-05-03T21:40:03Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Yiming/GSoC_2018/Questions&amp;diff=154679&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Yiming/GSoC_2018/Questions&amp;diff=154679&amp;oldid=prev"/>
		<updated>2018-06-28T21:24:05Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 21:24時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Yiming/GSoC_2018/Questions&amp;diff=154678&amp;oldid=prev</id>
		<title>2018年6月9日 (土) 11:03にwiki&gt;Yimingによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Yiming/GSoC_2018/Questions&amp;diff=154678&amp;oldid=prev"/>
		<updated>2018-06-09T11:03:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Quesions and answers==&lt;br /&gt;
&lt;br /&gt;
===On GPU/DRW/GWN===&lt;br /&gt;
&lt;br /&gt;
1. What's the difference between ShaderGroup/Pass/Framebuffer?&lt;br /&gt;
*ShaderGroup is used to warp a shader program (as in OpenGL).&lt;br /&gt;
*Pass is used to group Shader and drawing calls. It does not hold actual buffer object.&lt;br /&gt;
*Framebuffer is used to warp a FBO.&lt;br /&gt;
&lt;br /&gt;
2. What's the difference between GPU/DRW/GWN APIs?&lt;br /&gt;
*GPU is for warpping OpenGL objects and functions.&lt;br /&gt;
*DRW is for excuting drawing-related command.&lt;br /&gt;
*GWN is a batch tool to generate calls that can be passed to DRW.&lt;br /&gt;
&lt;br /&gt;
3. Can we use customized batch to draw primitives onto framebuffers?&lt;br /&gt;
*Yes, the DRW calls resets drawing states to its required state every time. So as long as your modification is covered by DRW, you are free to use your code.&lt;br /&gt;
&lt;br /&gt;
4. When matrix is not set, what coordinate is used when doing vertex shading?&lt;br /&gt;
*The default full screen rect shader doesn't have vertex transform in its vertex shader, and the coordinates is in the NDC coordinate.(X from -1 to 1, Y from -1 to 1)&lt;br /&gt;
&lt;br /&gt;
5. Can I set my own matrix using my own drawing codes? &lt;br /&gt;
*Yes, the matrix is reset when DRW needs it. So no worries for destroying drawing state.&lt;br /&gt;
&lt;br /&gt;
6. Does GPU/DRW support multisample textures? &amp;lt;br /&amp;gt;Also if it does support, can transform_to_screen() display it correctly? &amp;lt;br /&amp;gt;If not, how do we achieve multisample? By rendering it multiple times or something? &amp;lt;br /&amp;gt;Any APIs for doing it?&lt;br /&gt;
*Yes, then in shader use your Sampler2DMS texture refernce. Haven't tested if it displays correctly when using transform to screen function.&lt;br /&gt;
&lt;br /&gt;
8. How does blender's shader deal with object matrix?&lt;br /&gt;
*When creating a draw call, the last argument of DRW_shgroup_call_add() is obmat. DRW will internally generate MVP and normal matrix and pass them to the shaders.&lt;br /&gt;
&lt;br /&gt;
9. Uniform array assign.&lt;br /&gt;
*Seems a little tricky. Float array doesn't seem to work on vec4, and you should take care when using vec4 functions, the array number should be 1 instead of 4, otherwise it will be treated like a mat4 (which is a 4*4 matrix). See DRW_shgroup_uniform_vec4();&lt;br /&gt;
&lt;br /&gt;
===ON Mesh Operations===&lt;br /&gt;
&lt;br /&gt;
1. How to access mesh's global-space vertex position and global-space normal (original data prefered)&amp;lt;br /&amp;gt;.It seems that object drawing code is warpped by batch functions, then do we have functions for accesing these data directly?&lt;br /&gt;
*By applying ob-&amp;gt;obmat onto mesh vertex. The normal matrix is the inverse-transpose of ob-&amp;gt;obmat (but the 3X3 part is enough). There're several places where this is implemented on software side in blender. ob-&amp;gt;obmat is the final global matrix with everything(parents,constraints..) applied.&lt;br /&gt;
&lt;br /&gt;
2. BMesh creation, access and delete.&lt;br /&gt;
    Object* ob = some_mesh_object;&lt;br /&gt;
    Mesh* me = ob-&amp;gt;data;&lt;br /&gt;
    &lt;br /&gt;
    /* create bmesh holder */&lt;br /&gt;
    BMesh* bm = BM_mesh_create(&amp;amp;allocsize, &amp;amp;((struct BMeshCreateParams){.use_toolflags = true,}));&lt;br /&gt;
    &lt;br /&gt;
    /* fill bmesh data */&lt;br /&gt;
    BM_mesh_bm_from_me(bm, me, &amp;amp;((struct BMeshFromMeshParams){.calc_face_normal = true,}));&lt;br /&gt;
    &lt;br /&gt;
    /* this create the lookup table for bmesh. */&lt;br /&gt;
    /* if you want to access bmesh elements by index, then the table for correspoding type must be available */&lt;br /&gt;
    BM_mesh_elem_table_ensure(bm, BM_VERT|BM_EDGE|BM_FACE); /* creating one or two of them is also okay */&lt;br /&gt;
    &lt;br /&gt;
    /* access at index */&lt;br /&gt;
    BMEdge* e = BM_edge_at_index(bm,i/*uint32 index*/);&lt;br /&gt;
    &lt;br /&gt;
    /* destroy bmesh when you are done */&lt;br /&gt;
    BM_mesh_free(bm);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===On BLI===&lt;br /&gt;
&lt;br /&gt;
1. Usage on BLI_mempool_xxx?&lt;br /&gt;
    /* Creation */&lt;br /&gt;
    pool = BLI_mempool_create(sizeof(SomeStructure), 0 /* max element limit, 0 for no limit */, 512 /* element per trunk */, BLI_MEMPOOL_NOP /* flags */);&lt;br /&gt;
    &lt;br /&gt;
    /* Allocate */&lt;br /&gt;
    /* when trunk run out, a new one will be automatically added so the allocation will always success */&lt;br /&gt;
    /* unless out of memory or limit is set in pool */&lt;br /&gt;
    element = BLI_mempool_alloc(pool);&lt;br /&gt;
    element = BLI_mempool_calloc(pool);&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
&lt;br /&gt;
1. RNA/data Out of sync?&lt;br /&gt;
*New DepsGraph uses copy on write on many places. Some sync functions need to be manually added when modifying data. See T54810 for detail info.&lt;/div&gt;</summary>
		<author><name>wiki&gt;Yiming</name></author>
		
	</entry>
</feed>