Babylon.js
Babylon.js copied to clipboard
New SpriteMap Materials
So constantly people are asking for shadow and special effect support for the sprite map.
I was thinking of working on some extensions of the CustomMaterial and the PBRCustomMaterial to accommodate this.
https://forum.babylonjs.com/t/sprite-maps-and-light/21167 shows a really rudimentary hacky proof of concept. The correct way would be to actually rebuild the SpriteMap class to use a CustomStandardMaterial extension and then make a secondary PBR version. That way backwards compatibility is not broken and the power of all our materials will be leveraged.
Figured making a request for this would be the best way to get the ball rolling and track the progress as I wont be able to focus on this unless I have free time.
- [x] Create and upload to the public assets a normal map for the tileset
- [x] Create SpriteMapMaterial class and interfaces
- [ ] Redo the old SpiteMap to use the new Material
- [ ] Create a PBR Variance
- [ ] Create and upload to the public assets the pbr channel textures
- [ ] Create a PBR demo
https://playground.babylonjs.com/#ECMXID#22
A little better proof of concept.
I can prolly wrap this up this week. Work is winding down a little.
Looks like I'll be able to press forward on this some this weekend. Will post updates when I do.
Working on this now.
@deltakosh
I need to move #define CUSTOM_FRAGMENT_BEFORE_LIGHTS
On the default.fragment.fx from line 229 to line 246, I don't see this causing any regressions or breaking backwards dependencies, but then again it might in some cases.
Would this be ok, or should I define a different custom replace string? Just kind of seems odd that its placed before the specular stuff because the way its setup now you have no way to access that part of the customMaterial.
I think it makes sense.
I agree too
Ok thank you!
That will potentially break code if you move the define...
Currently, people can change uvOffset or vSpecularUV at the location of this define and it will be taken into account in the specular block as it is coming after. If you move the define after the block, that won't work anymore.
I think you should better add a new define instead.
Which ever way y'all want, just let me know.
Yeah after giving it more thoughts, I agree with @Popov72. Let's play it safe and secure
Yes, that's true the change can be made earlier...
I think that's ok to move the define, you should just drop a line in the Breaking changes section about that (I don't think a lot of people have updated uvOffset or vSpecularUV here anyway).
Arf!
@deltakosh is the boss so do as he suggested :)
Haha, I deleted my comment because I read it and thought I was dumb... then realized it was not.
Ill, add the new define!
I have this running really well on my local, I just need to redo the SpriteMap class to use the new material now and the standard part of this is done.
It will prolly be a while till I can do the PBR version as work is getting pretty loaded at this point.
Hi @Pryme8 - Are you still planning to work on it?
https://playground.babylonjs.com/#ECMXID#22
A little better proof of concept.
Really loved that, even more playing with specular, diffuse and intensity of different lights. The possibilities for this are many...
Any specific repo / branch?
@Pryme8 - will you have time to do it? Thanks!
I will need to get back to this at some point. Sorry it just kind of fell between the cracks.
Should we close it ? And we can reopen if needed
Yeah Id close this for now. I have the prototype of it done but just don't really have the time to look at it this second.