HomeForumsWhat's newResources 
 
 
Reading from the framebuffer?
XL2 - Aug 23, 2018

 < Prev  1  2  3  4  Next> 

 XL2 Dec 3, 2018
And it seems like it works!
I haven't tried on real hardware, but it should work too.
In these pictures, only the "sparkles" are using VDP2 transparency so it might be a bit hard to see.
It's also very low definition at just 160x112 so I guess it will look better with flat polygons and gouraud shading.

The only remaining issue is the scale as I just want to scale x by 0,455 and y 0.5 to have everything fit where it should go, but simply scaling my matrix will lead to issues (I just want screen space scaling).
Maybe I'll just manualy fix the draw commands or manualy generate draw commands, but it would be better to avoid always "patching" SGL and redo everything it does.

Edit : Added another picture with a basic box to better show how the transparency works on both VDP2 layers and VDP1. But the scale is still wrong, I will try to find a way to fix it this week.

 mrkotfw Dec 4, 2018
Excellent work.

This is a bit off topic, but I wonder if it's possible to use the SCU-DSP for software translucency (similar to PlayStation blending modes).

Possibly perform it in 8x8 or 16x16 "tiles". You have two tiles in each bank, and DMA the results to VDP2.

 XL2 Dec 5, 2018

mrkotfw said:

You mean using software rendering? I already wrote a simple software renderer using lines for transparency before trying the current technique.
The line technique is looking quite good but it creates too many draw commands.
The SCU could be useful to create the edges, but it has too limited memory for anything ambitious.
You can of course use different transparency ratios on the NBG0 or NBG1 layer, but it will apply on the whole layer.
I never tried per pixel color ratios, but that could be another solution using the BR technique for different blending values.
The only negative points are the sorting and the low definition.
For the speed, it seems to be quite fast with little impact on the framerate, but I need to use custom draw commands as it doesn't play nice with SGL.

Edit : With custom draw commands and proper scaling. I could probably not scale up that much and accept some lost pixels on the side of the screen to avoid such large edges, but I don't know if I should.

 XL2 Dec 7, 2018
Tested on real hardware and it works fine!
The framerate is mostly at 30 FPS, but it slows down more often to 20 than before (some optimizations would help improve that).

On a side note, could anyone give me a hand transforming some SGL functions?
It would be faster that using my own code since I could just use the whole SGL pipeline.
I just need to scale at screen space (again, x * 0.454545 and y * 0.5) after the transformation.
I know almost nothing about assembly atm, so could anyone point me where to look at?
Thanks!

Code:
  
sglC08.o:     file format coff-sh


Disassembly of section SLPROG:

00000000 <_slPutPolygon>:
       0:    e0 01           mov    #1,r0
       2:    c0 73           mov.b    r0,@(115,gbr)
       4:    c5 55           mov.w    @(170,gbr),r0
       6:    70 01           add    #1,r0
       8:    c1 55           mov.w    r0,@(170,gbr)
       a:    c6 22           mov.l    @(136,gbr),r0
       c:    51 41           mov.l    @(4,r4),r1
       e:    63 03           mov    r0,r3
      10:    c6 1d           mov.l    @(116,gbr),r0
      12:    65 3d           extu.w    r3,r5
      14:    62 0d           extu.w    r0,r2
      16:    32 1c           add    r1,r2
      18:    32 56           cmp/hi    r5,r2
      1a:    8d 46           bt.s    aa 
      1c:    65 29           swap.w    r2,r5
      1e:    52 43           mov.l    @(12,r4),r2
      20:    43 29           shlr16    r3
      22:    40 29           shlr16    r0
      24:    30 2c           add    r2,r0
      26:    30 36           cmp/hi    r3,r0
      28:    8d 3f           bt.s    aa 
      2a:    25 0d           xtrct    r0,r5
      2c:    d6 7b           mov.l    21c ,r6    ! 260ffc44
      2e:    c6 12           mov.l    @(72,gbr),r0
      30:    63 62           mov.l    @r6,r3
      32:    67 03           mov    r0,r7
      34:    30 30           cmp/eq    r3,r0
      36:    8f 3a           bf.s    ae 
      38:    c6 07           mov.l    @(28,gbr),r0
      3a:    17 11           mov.l    r1,@(4,r7)
      3c:    17 23           mov.l    r2,@(12,r7)
      3e:    66 03           mov    r0,r6
      40:    c6 09           mov.l    @(36,gbr),r0
      42:    41 08           shll2    r1
      44:    41 08           shll2    r1
      46:    30 1c           add    r1,r0
      48:    c2 09           mov.l    r0,@(36,gbr)
      4a:    e0 fc           mov    #-4,r0
      4c:    24 09           and    r0,r4
      4e:    51 40           mov.l    @(0,r4),r1
      50:    52 42           mov.l    @(8,r4),r2
      52:    53 44           mov.l    @(16,r4),r3
      54:    21 09           and    r0,r1
      56:    22 09           and    r0,r2
      58:    e0 fe           mov    #-2,r0
      5a:    23 09           and    r0,r3
      5c:    17 12           mov.l    r1,@(8,r7)
      5e:    17 24           mov.l    r2,@(16,r7)
      60:    17 35           mov.l    r3,@(20,r7)
      62:    e1 14           mov    #20,r1
      64:    17 10           mov.l    r1,@(0,r7)
      66:    60 53           mov    r5,r0
      68:    c2 1d           mov.l    r0,@(116,gbr)
      6a:    77 18           add    #24,r7
      6c:    50 60           mov.l    @(0,r6),r0
      6e:    51 61           mov.l    @(4,r6),r1
      70:    52 62           mov.l    @(8,r6),r2
      72:    53 63           mov.l    @(12,r6),r3
      74:    17 00           mov.l    r0,@(0,r7)
      76:    17 11           mov.l    r1,@(4,r7)
      78:    17 22           mov.l    r2,@(8,r7)
      7a:    17 33           mov.l    r3,@(12,r7)
      7c:    50 64           mov.l    @(16,r6),r0
      7e:    51 65           mov.l    @(20,r6),r1
      80:    52 66           mov.l    @(24,r6),r2
      82:    53 67           mov.l    @(28,r6),r3
      84:    17 04           mov.l    r0,@(16,r7)
      86:    17 15           mov.l    r1,@(20,r7)
      88:    17 26           mov.l    r2,@(24,r7)
      8a:    17 37           mov.l    r3,@(28,r7)
      8c:    50 68           mov.l    @(32,r6),r0
      8e:    51 69           mov.l    @(36,r6),r1
      90:    52 6a           mov.l    @(40,r6),r2
      92:    53 6b           mov.l    @(44,r6),r3
      94:    17 08           mov.l    r0,@(32,r7)
      96:    17 19           mov.l    r1,@(36,r7)
      98:    17 2a           mov.l    r2,@(40,r7)
      9a:    17 3b           mov.l    r3,@(44,r7)
      9c:    e0 30           mov    #48,r0
      9e:    30 7c           add    r7,r0
      a0:    d1 5f           mov.l    220 ,r1    ! 21000000
      a2:    c2 12           mov.l    r0,@(72,gbr)
      a4:    21 01           mov.w    r0,@r1
      a6:    00 0b           rts  
      a8:    e0 01           mov    #1,r0


[...]
And so on...

 XL2 Dec 20, 2018
(very) Slowly getting everything together.
On a side note, gouraud shading on the Saturn simply looks amazing, even with OpenGL's default gouraud shading settings you can't replicate such amazing lighting.
I ditched the color bank sprites for RGB sprites only to allow better lighting.
I think it's worth it as long as I can keep up the draw distance.
While I still have a ton of things to do on the engine, hopefully next year I'll be able to add dynamic lighting.

Here are some shots in SSF.

 David Gámiz Jiménez Dec 21, 2018
Seriously XL2.

You are amazing. Little by little, you are getting very far away! Congratulations!! Again XD

With respect to penalize drawing distance. You know what will happen, it is expensive to calculate. But you also know, that you have room to optimize. Just like you can apply a LOD by distance, for vertices and textures. You can scale the lighting detail by distances. From Gouraud with four vertices to a flat face. That affects several local lights to only one or only pre-calculated light. Finally for geometry in the far-clipping directly without shading, since with so few pixels hardly notice the effect. Adding up everything, you can compensate to have that magnificent light closer to the camera.

We already know, that all this will depend on your implementation of BSP or similar that you finally do. And that is a lot of work. Even, really, I do not know where SGL (closed) will let you do all this, to be able to optimize even more. It is clear that your creativity has no limit! Cheer up!

For anything you know that you can count, humbly, with my help.

Regards!

PD: It is difficult see in the screenshots. Is possible the Local Light are sum to main Paralell Light source in Sonic model?

 XL2 Dec 21, 2018

David Gmiz Jimnez said:

About possible slowdowns, I meant mainly with the gouraud shading adding something like 20 or 25% rendering time, which is quite a lot.
About the CPU, it can always be optimized, so I'm not too worried.
I will try to use the current octree implementation and add a PVS to it.
It should work as I can already build the BSP tree on the computer (I use it for lighting), so I just need to raycast to find visible nodes/leaves.
But that raycasting will be slow, so I might need to speed it up.
It won't eliminate overdraw, but it should reduce it quite a bit, even if it's useless to solve the problem with VDP2 transparent sprites.
That octree/pvs system won't be as efficient as a BSP/portal system obviously, but it's simplier for now to reuse what I have and it will work with Z-Treme's maps, so I can quickly test.
About the light on Sonic, it's just a "demo" light that turns around, I haven't implemented local lights on the Saturn side (only while converting on PC).
For the dynamic lighting, I will probably just use it on the high quality model, not on the low quality model. I want to try something like that :
DOMDocument Object ( [doctype] => (object value omitted) [implementation] => (object value omitted) [documentElement] => (object value omitted) [actualEncoding] => utf-8 [encoding] => utf-8 [xmlEncoding] => utf-8 [standalone] => 1 [xmlStandalone] => 1 [version] => [xmlVersion] => [strictErrorChecking] => 1 [documentURI] => [config] => [formatOutput] => [validateOnParse] => [resolveExternals] => [preserveWhiteSpace] => 1 [recover] => [substituteEntities] => [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 1 [nodeName] => #document [nodeValue] => [nodeType] => 13 [parentNode] => [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => [attributes] => [ownerDocument] => [namespaceURI] => [prefix] => [localName] => [baseURI] => [textContent] => Imgur: The magic of the Internet //!SSR:no -1===["i".concat("mgur.com"),"i".concat("mgur-stg.com"),"localhost"].indexOf(window.location.hostname)&&window.location.replace("https://i".concat("mgur.com")) !function(e,t,a,n){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var g=t.getElementsByTagName(a)[0],m=t.createElement(a);m.async=!0,m.src="https://www.googletagmanager.com/gtm.js?id=GTM-M6N38SF",g.parentNode.insertBefore(m,g)}(window,document,"script","dataLayer") document.addEventListener("ANAReady",()=>{initAssembly()});const initAssembly=()=>{let e={};try{const n=new URL(document.location).searchParams.get("campaign_id");n&&(e.campaign_id=n)}catch(e){console.error(e)}const n={enableSingleRequest:!0,sandboxIframe:!0,collapseEmptyDivs:!0,globalTargeting:e};window.ANA=new ANAWeb({gptOptions:n,syncCookies:!0,propertyId:"localhost"===window.location.hostname?"imgur.com":window.location.hostname,unifiedIdEnabled:!0})} !function(e,t){e[t]=e[t]||function e(){(e.q=e.q||[]).push(arguments)},e[t].v=e[t].v||2,function(e,c,n,o,d,i){function a(o,d){(o=function(c,n){try{if(n=(c=e.localStorage).getItem("_aQS02MzZCRjlDNzlEMDIyRDZGNjU3RkI3N0EtNA"))return JSON.parse(n).lgk||[];if((c.getItem(decodeURI(decodeURI("%76%253%34a%256%33%31%2565iZ%72%30")))||"").split(",")[4]>0)return[[t+"-engaged","true"]]}catch(e){}}())&&typeof o.forEach===n&&(d=e[c].pubads())&&o.forEach(function(e){e&&e[0]&&d.setTargeting(e[0],e[1]||"")})}try{(i=e[c]=e[c]||{}).cmd=i.cmd||[],typeof i.pubads===n?a():typeof i.cmd.unshift===n?i.cmd.unshift(a):i.cmd.push(a)}catch(e){}}(window,"googletag","function")}(window,decodeURI(decodeURI("%61%256%34%6di%25%372%61%256%63"))),function(e,t,c){c=e.createElement(t),e=e.getElementsByTagName(t)[0],c.async=1,c.src="https://quicklyedit.com/bundles/2f7d64b38b67/80b678c0231f11359553eba6.v1.js",e.parentNode.insertBefore(c,e)}(document,"script") dataLayer=[];var pbjs=pbjs||{};pbjs.que=pbjs.que||[] window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-6671908-2","auto") If you're seeing this message, that means JavaScript has been disabled on your browser, please enable JS to make Imgur work. )
Fatal error: Uncaught Error: Call to a member function getAttribute() on null in /var/www/html/sub/sx/messageParser.php:92 Stack trace: #0 /var/www/html/sub/sx/templates/remoteEmbed.php(20): DecodeImgur() #1 /var/www/html/sub/sx/templating.php(50): include('...') #2 /var/www/html/sub/sx/templating.php(51): Template->{closure}() #3 /var/www/html/sub/sx/templating.php(71): Template->render() #4 /var/www/html/sub/sx/templating.php(41): Stencil->render() #5 /var/www/html/sub/sx/messageParser.php(199): Template->include() #6 /var/www/html/sub/sx/messageParser.php(9): ParseNode() #7 /var/www/html/sub/sx/templates/message.php(35): ParseMessageContent() #8 /var/www/html/sub/sx/templating.php(50): include('...') #9 /var/www/html/sub/sx/templating.php(51): Template->{closure}() #10 /var/www/html/sub/sx/templating.php(71): Template->render() #11 /var/www/html/sub/sx/templating.php(41): Stencil->render() #12 /var/www/html/sub/sx/templates/threads.php(55): Template->include() #13 /var/www/html/sub/sx/templating.php(50): include('...') #14 /var/www/html/sub/sx/templating.php(51): Template->{closure}() #15 /var/www/html/sub/sx/templating.php(71): Template->render() #16 /var/www/html/sub/sx/index.php(89): Stencil->render() #17 {main} thrown in /var/www/html/sub/sx/messageParser.php on line 92