Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallbacks for techniques #84

Closed
RemiArnaud opened this issue Apr 28, 2013 · 137 comments
Closed

fallbacks for techniques #84

RemiArnaud opened this issue Apr 28, 2013 · 137 comments

Comments

@RemiArnaud
Copy link
Contributor

According to the space, the following technique names can be provided to provide more guidance:

Lambert
Phong
Blinn-Phong

  1. missing from that list: constant

  2. the converter should follow the spec, specifically for duck.json, 'Blinn-Phong' should be used instead of 'technique1'

  3. regarding the spec, this is not a name, this is an id.

@fabrobinet
Copy link
Contributor

  1. ok with that
    1. having any technique ID is fine, sorry if the SPEC is not clear about it I will review that.
      But There should be a technique name that is actually not exported. And this technique name will specify "Lambert", "Phong" ...

@RemiArnaud
Copy link
Contributor Author

name is too weak.
This information is significant as this is what will be used by a viewer
that does not use the shader provided, but its own shaders.
I'd say: introduce fallback, and have some fallbacks pre-defined by the
glTF spec (same as in the COLLADA spec BTW).

On Fri, May 3, 2013 at 9:40 AM, Fabrice Robinet [email protected]:

  1. ok with that
    1. having any technique ID is fine, sorry if the SPEC is not clear
      about it I will review that.
      But There should be a technique name that is actually not exported. And
      this technique name will specify "Lambert", "Phong" ...


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-17404750
.

@fabrobinet
Copy link
Contributor

How do you want to represent fallbacks ?

@tparisi
Copy link
Contributor

tparisi commented May 3, 2013

Remi, seriously? This is exactly what I was saying 2 months ago and you
talked me out of it!

For what it's worth, I agree, we should have predefined names for common
techniques and fallbacks in case a viewer doesn't implement them.

On Fri, May 3, 2013 at 10:18 AM, Fabrice Robinet
[email protected]:

How do you want to represent fallbacks ?


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-17406777
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

@fabrobinet
Copy link
Contributor

Well, also... I suggested something like this initially , you can replace "description" by "fallback" if you like.

"description" : {   
               "generator" : "COLLADA2GLTF",
               "type" : "COLLADA-1.4.1/commonProfile",
               "commonProfile" : {
                   "technique" : "Phong",
                   "diffuse" : "aColor"               <--- here we could refer to the parameters inside the technique instead of redeclaring everything...
               }
           },

It could be more clever and reuse parameters from the shaders to be aligned with Remi's input (2 months ago).
But it strongly defines where this profile definition comes from.
It is located inside the technique.

Well, it needs refinement, but you get the idea.
Also, it might be good to hold infos needed by #47

@pjcozzi
Copy link
Member

pjcozzi commented May 16, 2013

For what it's worth, I agree, we should have predefined names for common techniques and fallbacks in case a viewer doesn't implement them.

👍

@fabrobinet I'll need to see a more refined and complete example to provide feedback, but to start, I don't think we needed generator there, I would expect to see it per asset, not per technique.

@fabrobinet
Copy link
Contributor

Agreed about generator. I'll provide an example that include #47 needs.

@RemiArnaud
Copy link
Contributor Author

What I was suggesting is that we have pre-defined fallback shaders, with
specific naming convention.
Those shaders can be provided in the glTF repository as source code, can be
used as-is by applications, can be embedded in the glTF files, can be used
as reference by the applications.

Regards
--- Remi

On Thu, May 16, 2013 at 12:46 PM, Fabrice Robinet
[email protected]:

Agreed about generator. I'll provide an example that include #47https://github.com/KhronosGroup/glTF/issues/47needs.


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-18024515
.

@tparisi
Copy link
Contributor

tparisi commented May 16, 2013

I believe we need to support 3 scenarios for shaders:

1 - Shipped with the content, the way the convert currently does it
2 - Fallbacks per Remi's suggestion
3 - Ability for an implementation to override any common techniques e.g.
Blinn based on the technique hints

I am not sure what the priority of these should be. I need to think about
that.

Tony

On Thu, May 16, 2013 at 1:37 PM, Rémi Arnaud [email protected]:

What I was suggesting is that we have pre-defined fallback shaders, with
specific naming convention.
Those shaders can be provided in the glTF repository as source code, can
be
used as-is by applications, can be embedded in the glTF files, can be used
as reference by the applications.

Regards
--- Remi

On Thu, May 16, 2013 at 12:46 PM, Fabrice Robinet
[email protected]:

Agreed about generator. I'll provide an example that include #47<
https://github.com/KhronosGroup/glTF/issues/47>needs.


Reply to this email directly or view it on GitHub<
https://github.com/KhronosGroup/glTF/issues/84#issuecomment-18024515>
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-18027416
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

@fabrobinet
Copy link
Contributor

I am not sure then, how these fallback shaders would be different from the ones generated by the converter. We don't want to specify any shader implementation (I think we agreed on that), so I took fallback as way to use the provided shaders and use parameters to regenerate your own. Sorry for the misunderstanding.

@RemiArnaud you started the issue by asking for an id instead of name, that is why I was proposing to mention explicitly where the generated shaders where coming from.

@fabrobinet
Copy link
Contributor

@tparisi what you call the technique hints are the parameters and the name of the technique right ? by "override" I understand you mean regenerate shaders. Which is what a possibility we indeed agreed to provide since the beginning.

Now I still don't really get how the fallbacks would work exactly.

Also the shaders that are generated by the converter already follow naming convention for the parameters.That is why I don't know what the fallback shaders would be.

@tparisi
Copy link
Contributor

tparisi commented May 16, 2013

Fab

I think what Remi means by "fallbacks" is essentially default
implementations.

Here is my view: a valid glTF material could have any of the following.

  1. No shader code supplied - just technique info and param values: requires
    application to have an implementation of the technique;
  2. Shader code is supplied with the content, along with technique info;
    the application can use the supplied shader code or its own implementation
    if it has one;
  3. Shader only is supplied, no common technique information; the
    application must use the shader code supplied.

Converters and exporters can provide options for what to output.

Tony

On Thu, May 16, 2013 at 1:44 PM, Fabrice Robinet
[email protected]:

I am not sure then, how these fallback shaders would be different from the
ones generated by the converter. We don't want to specify any shader
implementation (I think we agreed on that), so I took fallback as way to
use the provided shaders and use parameters to regenerate your own. Sorry
for the misunderstanding.

@RemiArnaud https://github.com/RemiArnaud you started the issue by
asking for an id instead of name, that is why I was proposing to mention
explicitly where the generated shaders where coming from.


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-18027856
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

@tparisi
Copy link
Contributor

tparisi commented May 16, 2013

See my other message for clarification on how I think it should work.

If we have "fallback implementations," (again I prefer to call the
"default"), these would be the same pieces of source code as the ones
supplied with the content by the converter. However if an application wants
to have smaller downloads it can opt for generating files that do not
have shaders in the content; it would have the "default implementations"
built into its own engine code. That way it doesn't need to include the
shader in the payload, it's already built into the app.

Am I making sense?

On Thu, May 16, 2013 at 1:58 PM, Fabrice Robinet
[email protected]:

@tparisi https://github.com/tparisi what you call the technique hints
is are the parameters and the name of the technique right ? by "override" I
understand you mean regenerate shaders. Which is what a possibility we
indeed agreed to provide since the beginning.

Now I still don't really get how the fallbacks would work exactly.

Also the shaders that are generated by the converter already follow naming
convention for the parameters.That is why I don't know what the fallback
shaders would be.


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-18028620
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

@RemiArnaud
Copy link
Contributor Author

My suggestion covers all the use cases.
Shaders should have a fallback (or multiple fallbacks).
The last fallback is a standard shader that the converter can attach or not
(converter option).
Applications can implement this their own way.

Regards
-- Remi

On Thu, May 16, 2013 at 1:42 PM, Tony Parisi [email protected]:

I believe we need to support 3 scenarios for shaders:

1 - Shipped with the content, the way the convert currently does it
2 - Fallbacks per Remi's suggestion
3 - Ability for an implementation to override any common techniques e.g.
Blinn based on the technique hints

I am not sure what the priority of these should be. I need to think about
that.

Tony

On Thu, May 16, 2013 at 1:37 PM, Rémi Arnaud [email protected]:

What I was suggesting is that we have pre-defined fallback shaders, with
specific naming convention.
Those shaders can be provided in the glTF repository as source code, can
be
used as-is by applications, can be embedded in the glTF files, can be
used
as reference by the applications.

Regards
--- Remi

On Thu, May 16, 2013 at 12:46 PM, Fabrice Robinet
[email protected]:

Agreed about generator. I'll provide an example that include #47<
https://github.com/KhronosGroup/glTF/issues/47>needs.


Reply to this email directly or view it on GitHub<
https://github.com/KhronosGroup/glTF/issues/84#issuecomment-18024515>
.


Reply to this email directly or view it on GitHub<
https://github.com/KhronosGroup/glTF/issues/84#issuecomment-18027416>
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-18027764
.

@tparisi
Copy link
Contributor

tparisi commented May 16, 2013

Riight.

I think it's just a nomenclature issue.

If the idea is to have the implementation try to interpret the techniques
and supply its own shader code if possible, then "fallback" is the right
name for it.

If on the other hand, the default is to have the application honor the
shader supplied in the content unless it decides to override, "default
implementation" would be a better name.

Subtle.

Tony

On Thu, May 16, 2013 at 2:04 PM, Rémi Arnaud [email protected]:

My suggestion covers all the use cases.
Shaders should have a fallback (or multiple fallbacks).
The last fallback is a standard shader that the converter can attach or
not
(converter option).
Applications can implement this their own way.

Regards
-- Remi

On Thu, May 16, 2013 at 1:42 PM, Tony Parisi [email protected]:

I believe we need to support 3 scenarios for shaders:

1 - Shipped with the content, the way the convert currently does it
2 - Fallbacks per Remi's suggestion
3 - Ability for an implementation to override any common techniques e.g.
Blinn based on the technique hints

I am not sure what the priority of these should be. I need to think
about
that.

Tony

On Thu, May 16, 2013 at 1:37 PM, Rémi Arnaud [email protected]:

What I was suggesting is that we have pre-defined fallback shaders,
with
specific naming convention.
Those shaders can be provided in the glTF repository as source code,
can
be
used as-is by applications, can be embedded in the glTF files, can be
used
as reference by the applications.

Regards
--- Remi

On Thu, May 16, 2013 at 12:46 PM, Fabrice Robinet
[email protected]:

Agreed about generator. I'll provide an example that include #47<
https://github.com/KhronosGroup/glTF/issues/47>needs.


Reply to this email directly or view it on GitHub<
https://github.com/KhronosGroup/glTF/issues/84#issuecomment-18024515>
.


Reply to this email directly or view it on GitHub<
https://github.com/KhronosGroup/glTF/issues/84#issuecomment-18027416>
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

Reply to this email directly or view it on GitHub<
https://github.com/KhronosGroup/glTF/issues/84#issuecomment-18027764>
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-18029003
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

@fabrobinet
Copy link
Contributor

Ok thanks, I see what you mean now. Yes we talked about the possibility of passing/forcing shaders to the converter.

I'd like to split this issue in two to keep things clear:

    1. Track in another issue the formatting of "standard" parameters and "technique" name to be able to regenerate shaders.
  • 2 Once Set index for SEMANTIC #1 is done) get proposal for fallbacks and feature set in this issue. For instance, how will we connect parameters from the provided shaders to the input asset ? what should be the granularity of "fallbacks" ? how to pick up the right one ? can this be all made within the converter ? will this impact the SPEC ?...

@fabrobinet
Copy link
Contributor

@RemiArnaud If you don't mind, please take the lead on this one. I will work in 1) in the meantime/before.

@ghost ghost assigned fabrobinet May 16, 2013
@RemiArnaud
Copy link
Contributor Author

BTW, it is ok not to have all attributes connected to the default shader, and it is ok not to have required attributed in the geometry (default values for attributes)

  • Remi

@RemiArnaud
Copy link
Contributor Author

There could be more than one fallback.
Application can decide to use different versions of the shader depending of platform, LOD ...

@RemiArnaud
Copy link
Contributor Author

I think we probably should finalize the 'geometry/overrides' design first?

@tparisi
Copy link
Contributor

tparisi commented May 17, 2013

Yes, good idea.

On Thu, May 16, 2013 at 6:30 PM, Rémi Arnaud [email protected]:

I think we probably should finalize the 'geometry/overrides' design first?


Reply to this email directly or view it on GitHubhttps://github.com//issues/84#issuecomment-18039248
.

Tony Parisi [email protected]
CTO at Large 415.902.8002
Skype auradeluxe
Follow me on Twitter! http://twitter.com/auradeluxe
Read my blog at http://www.tonyparisi.com/
Learn WebGL http://learningwebgl.com/

Read my book! WebGL, Up and Running
http://shop.oreilly.com/product/0636920024729.do
http://www.amazon.com/dp/144932357X

@ghost ghost assigned RemiArnaud May 19, 2013
@fabrobinet
Copy link
Contributor

Yes I am working on #82

@fabrobinet
Copy link
Contributor

Acutally on #92

@fabrobinet
Copy link
Contributor

I think my confusion was that I wanted to discuss first about specifying a way to let developers regenerate states and shaders from high level information. Rather than fallback that may carry themself shaders and states.
So to track that which I believe should come first, I will enter an issue.

@fabrobinet
Copy link
Contributor

Please, let's take care of #97 first, then I'll be happy to discuss further details for fallbacks.

@pjcozzi pjcozzi mentioned this issue Apr 30, 2014
8 tasks
@pjcozzi pjcozzi removed this from the Spec 1.0 milestone Aug 27, 2015
@tparisi
Copy link
Contributor

tparisi commented Oct 5, 2015

right on all counts, fixed typos and yes I need to define default.

@tparisi
Copy link
Contributor

tparisi commented Oct 5, 2015

@pjcozzi oh and I think that means that technique is optional in a material?

@pjcozzi
Copy link
Member

pjcozzi commented Oct 5, 2015

Yes, technique is optional.

@tparisi
Copy link
Contributor

tparisi commented Oct 5, 2015

@RemiArnaud
Copy link
Contributor Author

Just wondering how per vertex color would fit in this model ?

Regards
— Remi

On Oct 5, 2015, at 4:58 PM, Tony Parisi [email protected] wrote:

@pjcozzi can you review the common materials extension? Fairly done https://github.com/KhronosGroup/glTF/blob/spec-1.0/extensions/Khronos/KHR_materials_common/README.md


Reply to this email directly or view it on GitHub.

@tparisi
Copy link
Contributor

tparisi commented Oct 6, 2015

which model? common materials? yeah we probably need to handle per-vertex color and normal flags in there. good catch.

@tparisi
Copy link
Contributor

tparisi commented Oct 6, 2015

@pjcozzi I need help figuring out rendering default if technique is optional. I mentioned 80% gray as a default. is that emissive or diffuse? e.g. if the implementation has lights it can do a diffuse color on that assuming normals are supplied (or generated). that's a lot more interesting than just emissive, which will look like indistinct blobs on the screen... requires more thought. feeling like opening a separate issue on this.

@pjcozzi
Copy link
Member

pjcozzi commented Oct 6, 2015

Comments:

  • The JSON examples are inconsistent. Both 1 and 1.0 are used. Arrays are sometimes on the same line and sometimes one element per line.
  • index_of_refraction -> indexOfRefraction. glTF uses camel case for property names.
    • Same for constant_attenuation, linear_attenuation, falloff_angle, and falloff_exponent.
  • Are we sure CONSTANT needs all those properties? How is each used?
  • FLOAT_VEC4 or SAMPLER_2D -> In glTF, what is sampler 2D? Shouldn't this be a string (texture id)? We need to precisely define where the texture coordinates come from, e.g., if both diffuse and specular are texures, do they use the same or different set of texture coordinates?
  • technique - why does this have a default? Perhaps it should be required. We should also make this separate from the table and say the table is for the values object.
  • "relective": "texture_envmap" - glTF does not support cube maps.
  • This needs to include the equations.
  • This needs to include some discussion on how vertex attributes use semantics to map material inputs, e.g., normals, texture coordinates, etc.

To-do: Patrick need schema for each of the material types... can you help?

Maybe, but I did to finish the core spec reference doc first. Will let you know later this week.

@pjcozzi
Copy link
Member

pjcozzi commented Oct 6, 2015

which model? common materials? yeah we probably need to handle per-vertex color and normal flags in there. good catch.

Or just use raw glTF techniques. I don't know that this is widely enough used to justify making the spec more complicated.

@pjcozzi
Copy link
Member

pjcozzi commented Oct 6, 2015

@pjcozzi I need help figuring out rendering default if technique is optional. I mentioned 80% gray as a default. is that emissive or diffuse?

I would think diffuse, but it would also need some ambient. Why not define it as a Lambert material and then we can fine tune the values when @tfili has an implementation.

@tparisi
Copy link
Contributor

tparisi commented Oct 6, 2015

yeah that's a good idea.

I'm going to open another issue for the common materials extension. too much noise in here.

@tparisi
Copy link
Contributor

tparisi commented Oct 6, 2015

moved common materials discussion to #424

@emackey
Copy link
Member

emackey commented Oct 6, 2015

@pjcozzi I need help figuring out rendering default if technique is optional. I mentioned 80% gray as a default. is that emissive or diffuse?

I would think diffuse, but it would also need some ambient. Why not define it as a Lambert material and then we can fine tune the values when @tfili has an implementation.

Just my $0.02, but if the only reason we need a default is so that this property can be optional for the sake of extensions, then I think it's reasonable to expect most users to either supply the property or implement an extension. So the default can be brain-dead, such as half-gray emmissive with no lighting, to keep it simple and to encourage supplying of better values.

@pjcozzi
Copy link
Member

pjcozzi commented Oct 6, 2015

Good point @emackey. That would be fine with me.

@pjcozzi pjcozzi removed the tools label Oct 9, 2015
tparisi added a commit that referenced this issue Oct 12, 2015
@tparisi
Copy link
Contributor

tparisi commented Oct 12, 2015

@pjcozzi please review the language...

@pjcozzi
Copy link
Member

pjcozzi commented Oct 12, 2015

Looks good with two comments:

  • Perhaps add a short non-normative section on why, e.g., we don't expect apps to use this fallback, but instead want to allow materials in extensions without having to provide a dummy technique.
  • Add glTF material/technique/program/shader example for the default shade. @tfili can you provide this?

@pjcozzi
Copy link
Member

pjcozzi commented Oct 15, 2015

@tfili do you happen to have this?

Add glTF material/technique/program/shader example for the default shade.

@pjcozzi
Copy link
Member

pjcozzi commented Oct 15, 2015

Labeled post 1.0.

@pjcozzi
Copy link
Member

pjcozzi commented Oct 23, 2015

@tfili this is all we need to close this:

Add glTF material/technique/program/shader example for the default shader. @tfili can you provide this?

Can you provide this?

@tfili
Copy link

tfili commented Oct 23, 2015

A default material would be a constant gray color, like defined with the material below using the KHR_materials_common extension.

"materials": {
        "Effect1": {
            "extensions": {
                "KHR_materials_common": {
                    "technique": "CONSTANT",
                    "values": {
                        "emission": [
                            0.8,
                            0.8,
                            0.8,
                            1
                        ]
                    }
                }
            }
        }
    },

During runtime we would generate the following json objects

    "materials": {
        "Effect1": {
            "values": {
                "emission": [
                    0.8,
                    0.8,
                    0.8,
                    1
                ]
            },
            "technique": "technique0"
        }
    },
    "programs": {
        "program0": {
            "attributes": [
                "a_normal",
                "a_position",
                "a_texcoord_0"
            ],
            "fragmentShader": "fragmentShader0",
            "vertexShader": "vertexShader0"
        }
    },
    "shaders": {
        "vertexShader0": {
            "type": 35633,
            "uri": "data:text/plain;base64,...",
        },
        "fragmentShader0": {
            "type": 35632,
            "uri": "data:text/plain;base64,..."
        }
    },
    "techniques": {
        "technique0": {
            "attributes": {
                "a_normal": "normal",
                "a_position": "position"
            },
            "parameters": {
                "modelViewMatrix": {
                    "semantic": "MODELVIEW",
                    "type": 35676
                },
                "normalMatrix": {
                    "semantic": "MODELVIEWINVERSETRANSPOSE",
                    "type": 35675
                },
                "projectionMatrix": {
                    "semantic": "PROJECTION",
                    "type": 35676
                },
                "emission": {
                    "type": 35666
                },
                "normal": {
                    "semantic": "NORMAL",
                    "type": 35665
                },
                "position": {
                    "semantic": "POSITION",
                    "type": 35665
                }
            },
            "program": "program0",
            "states": {
                "enable": [
                    2884,
                    2929
                ]
            },
            "uniforms": {
                "u_modelViewMatrix": "modelViewMatrix",
                "u_normalMatrix": "normalMatrix",
                "u_projectionMatrix": "projectionMatrix",
                "u_emission": "emission"
            }
        }
    }

The shaders would be

Vertex:

precision highp float;
uniform mat4 u_modelViewMatrix;
uniform mat3 u_normalMatrix;
uniform mat4 u_projectionMatrix;
attribute vec3 a_normal;
attribute vec3 a_position;
void main(void) {
  gl_Position = u_projectionMatrix * u_modelViewMatrix * vec4(a_position,1.0);
}

Fragment:

precision highp float;
uniform vec4 u_emission;
void main(void) {
  gl_FragColor = u_emission;
}

Obviously encoding in a data URI wouldn't be the ideal situation but it would work with existing engines. One option could be to add an extras property the contains the glsl source string directly, but that would be up to the implementer.

@pjcozzi
Copy link
Member

pjcozzi commented Nov 9, 2015

Thanks @tfili. I added this to the spec in the 1.0-final branch. fefc152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants