Watch this video:
http://www.youtube.com/watch?v=kSPknysJaVY (http://www.youtube.com/watch?v=kSPknysJaVY)
One of the my tests with sprites and background, it was perfect  ;), would like to put an the spriter BG0 between BG1 and in this example it stayed behind the BG0 and BG1, this is part of my code:
// Copy tiles to VRAM
bgInitTileSet(1, &patterns_bg, &palette_bg, 3, (&patterns_end_bg - &patterns_bg), (&palette_end_bg - &palette_bg), BG_16COLORS, 0x6000);
bgInitTileSet(0, &patterns_fence, &palette_fence, 4, (&patterns_end_fence - &patterns_fence), (&palette_end_fence - &palette_fence), BG_16COLORS, 0x5000);	
// Copy Map to VRAM
bgInitMapSet(1, &map_bg, (&map_end_bg - &map_bg),SC_32x32, 0x4800);
bgInitMapSet(0, &map_fence, (&map_end_fence - &map_fence),SC_32x32, 0x4000);		
//My Char Kyle Blackthorne	
oamInitGfxSet(&gfxpsrite_kyle_1, (&gfxpsrite_end_kyle_1 - &gfxpsrite_kyle_1), &palsprite_kyle_1, 0, 0x0000, OBJ_SIZE32);
oamSet(0,  mycharKyle.x, mycharKyle.y, 0, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0); 
oamSetEx(0, OBJ_LARGE, OBJ_SHOW);	
	
setMode(BG_MODE1, 0);  bgSetDisable(2);
With this code he stands in front of all background
oamSet(0,  mycharKyle.x, mycharKyle.y, 3, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0); 
I would like to stay sprite between background.  ;D
			
			
			
				I have not tested but following the instructions of the wiki (http://www.portabledev.com/wiki/doku.php?id=sprites_en) the priority parameter of the oamSet function is relative to the BG
Citationpriority    priority relative to BG : 0 for Low and 3 is the highest 
In your code your backgrounds are numbered 0 and 1.
Your first test the priority at 0 masks you hide your sprites (lowest priority)
Your 2nd test the priority set to high (3) show you the sprites.
So my guess is if you set the priority to 1 your sprite will be between the both BG.
With 3 layers, noted 0,1,2 I supposed than that priority parameter can be set to 2 for example : It's not a binary (0 or 3) value, you can use 0,1,2 or 3  ;)
I hope alekmaul will confirm that point.
PS : sorry for my awful english  :-[
			
				had already read it, I thought this was only for the priority Gfxs (sprites) and did not work with the BGS, now that quoted calmly read again the documentation can be really so, however I believe that had already tried. 
priority =  priority relative to BG : 0 for Low and 3 is the highest 
test again and post the result
			
			
			
				Thanks Brother it worked perfectly, I believe that had not achieved because the MODE1 the Bg 3 only works with 4 colors however got the result you want to see
(http://img829.imageshack.us/img829/9079/snesdevbgandsprites.png)
Code:
bgInitTileSet(2, &patterns_bg, &palette_bg, 4, (&patterns_end_bg - &patterns_bg), (&palette_end_bg - &palette_bg), BG_4COLORS, 0x6000);
bgInitTileSet(0, &patterns_fence, &palette_fence, 5, (&patterns_end_fence - &patterns_fence), (&palette_end_fence - &palette_fence), BG_16COLORS, 0x5000);	
bgInitMapSet(2, &map_bg, (&map_end_bg - &map_bg),SC_32x32, 0x4800);
bgInitMapSet(0, &map_fence, (&map_end_fence - &map_fence),SC_32x32, 0x4000);		
	
oamInitGfxSet(&gfxpsrite_kyle_1, (&gfxpsrite_end_kyle_1 - &gfxpsrite_kyle_1), &palsprite_kyle_1, 0, 0x0000, OBJ_SIZE32);
oamSet(0,  mycharKyle.x, mycharKyle.y, 1, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0); 
oamSetEx(0, OBJ_LARGE, OBJ_SHOW);	
	
setMode(BG_MODE1, 0);
 
However lost background-1 and he has 16 colors that makes the background even more beautiful, is it not possible through the previous code?
			
			
			
				Have you tried this setting  ?
bgInitTileSet(1, &patterns_bg, &palette_bg, 4, (&patterns_end_bg - &patterns_bg), (&palette_end_bg - &palette_bg), BG_4COLORS, 0x6000);
bgInitTileSet(0, &patterns_fence, &palette_fence, 5, (&patterns_end_fence - &patterns_fence), (&palette_end_fence - &palette_fence), BG_16COLORS, 0x5000);	
bgInitMapSet(1, &map_bg, (&map_end_bg - &map_bg),SC_32x32, 0x4800);
bgInitMapSet(0, &map_fence, (&map_end_fence - &map_fence),SC_32x32, 0x4000);		
	
oamInitGfxSet(&gfxpsrite_kyle_1, (&gfxpsrite_end_kyle_1 - &gfxpsrite_kyle_1), &palsprite_kyle_1, 0, 0x0000, OBJ_SIZE32);
oamSet(0,  mycharKyle.x, mycharKyle.y, 1, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0); 
oamSetEx(0, OBJ_LARGE, OBJ_SHOW);	
	
setMode(BG_MODE1, 0);
 
			
			
			
				yes, oddly only works with this code I quoted, with your code:
...
oamSet(0,  mycharKyle.x, mycharKyle.y, 0, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0); 
...
or
..
oamSet(0,  mycharKyle.x, mycharKyle.y, 1, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0); 
..
Stands behind and with that always stays in front
..
oamSet(0,  mycharKyle.x, mycharKyle.y, 2, 0, 0, sprTiles[mycharKyle.positionOffSetSpriter], 0); 
..
			
			
			
				yes, take a look here : http://www.portabledev.com/wiki/doku.php?id=sprites_en
Priority flag (3rd) is : priority relative to BG : 0 for Low and 3 is the highest 
			
			
			
				Citation de: alekmaul le 10 Janvier 2013 à 06:32:23
yes, take a look here : http://www.portabledev.com/wiki/doku.php?id=sprites_en
Priority flag (3rd) is : priority relative to BG : 0 for Low and 3 is the highest
That's where I redirected him too.
His problem is that he wants to have, in Mode 1, 2 BG of 16 colors and his sprite between that 2 BG (so in fact a BG and a FG).
He has succeded to put the sprite between the two layers with 0 and 2 as BG's id and 1 as priority flag.
It doesn't seem to work with another combination.
But with that solution he looses the 16 colors of the 2nd background, because of the limitations of Mode 1 (http://www.portabledev.com/wiki/doku.php?id=backgrounds_en) I guess
Mode    # Colors for BG
         1   2   3   4
======---=---=---=---=
0        4   4   4   4
1       16  16   4   -
2       16  16   -   -
3      256  16   -   -
4      256   4   -   -
5       16   4   -   -
6       16   -   -   -
7      256   -   -   -
7EXTBG 256 128   -   - 
			
			
				I want to develop a game rpg, this technique with sprites between bgs who would want to put trees on top of the sprite thus creating a depth effect, i will make new test with this idea and will post the results
			
			
			
				Great, thanks , waiting for that.
Began to do a ultima3 RPG for NDS, perhaps will adapt it for SNES ^^
			
			
			
				Look this brothers:  ;D 
http://www.youtube.com/watch?v=dWz7ZWBXdcU (http://www.youtube.com/watch?v=dWz7ZWBXdcU)
The Graphics is bad  ;) , i am studying color palettes, however this to get an idea of what I intend to do, this case I'll add the character to stay behind the trees. In the future, with an awesome graphic artist, the game will have beautiful graphics.  ::) 
I buy the Pier Solar for Sega Genesis saw how far we can get with dedication, the boss of the project is a Brazilian like myself.
alekmaul i loved Ultima, i have this game for Nes ;) i search this games for other consoles. 
Waiting for that games too.
			
			
			
				I made many tests, discovered that this is a problem of lib, because I came to this conclusion? as you can see bgSet trees is 0, so in theory the sprite set as priority 1 would be in front from the trees.
When I start the sprite priority 0 or 1, the sprite is always behind the trees, look this code:
mychar.priority = 0;
//Init spite
oamInitGfxSet(&gfxpsrite, (&gfxpsrite_end - &gfxpsrite), &palsprite, 0, 0x0000, OBJ_SIZE32);		
oamSet(0,  mychar.x, mychar.y,  mychar.priority, 0, 0, 0, 0);
oamSetEx(0, OBJ_LARGE, OBJ_SHOW);	
//Init Map
bgInitTileSet(0, &patterns, &palette, 0, (&patterns_end - &patterns), 16*2, BG_16COLORS, 0x6000);
bgInitMapSet(0, &map, (&map_end - &map), SC_64x64, 0x5000);
Prints
mychar.priority = 0;
(http://imageshack.us/a/img442/2190/gamerpgengine2013012023.png)
mychar.priority = 1;
(http://imageshack.us/a/img838/2190/gamerpgengine2013012023.png)
but when put as priority 2 sprite goes to the front from the trees
mychar.priority = 2;
(http://imageshack.us/a/img515/2190/gamerpgengine2013012023.png)
alekmaul have any idea what you can this happening?
			
			
			
				Nope, no idea of that problem, will take a look when i will have time.
You're sure you're refreshing oam memory each time ?
			
			
			
				you refer to it?
	while(1) {		
	...
	...		
		if (move) bgSetScroll(0, scrX,scrY);
		//this is refreshing oam memory?
		oamSet(0,  mychar.x, mychar.y,  mychar.priority, mychar.direcionSpriter, 0, sprTiles[mychar.positionOffSetSpriter], 0); 
			
		WaitForVBlank();
	}
In background mode 2
setMode(BG_MODE2,0);  
work as I want
Layer 0
Sprite
Layer 1
but mode 2 only has two layers :'(, different mode 1 having three layers .
			
			
			
				I came to another conclusion, in example "Transparency" I changed the code default for:
      // Initialize SNES 
	consoleInit();
	// Copy tiles to VRAM
	bgInitTileSet(0, &LandTiles, &LandPalette, 1, (&LandTiles_end - &LandTiles), (&LandPalette_end - &LandPalette), BG_16COLORS, 0x0000);
	bgInitTileSet(1, &CloudTiles, &CloudPalette, 0, (&CloudTiles_end - &CloudTiles), (&CloudPalette_end - &CloudPalette),  BG_4COLORS, 0x1000);
	// Copy Map to VRAM
	bgInitMapSet(0, &Maps, (&Maps_end - &Maps),SC_32x32, 0x2000);
	bgInitMapSet(1, &Mapsc, (&Mapsc_end - &Mapsc),SC_32x32, 0x2400);
	// Now Put in 16 color mode and put cloud on top of screen
	setMode(BG_MODE1, BG3_MODE1_PRORITY_HIGH); bgSetDisable(2);  
	// Set BG3 SubScreen and 
	bgSetEnableSub(1);
	
	// enable Subscreen Color ADD/SUB and Color addition on BG1 and Backdrop color
	setColorEffect(CM_SUBBGOBJ_ENABLE, CM_MSCR_BACK | CM_MSCR_BG1);
(http://imageshack.us/a/img546/8121/transparencyex1.jpg)
its working normally, BG1 front in BG0, but coment this parte the code:
      // Initialize SNES 
	consoleInit();
	// Copy tiles to VRAM
	bgInitTileSet(0, &LandTiles, &LandPalette, 1, (&LandTiles_end - &LandTiles), (&LandPalette_end - &LandPalette), BG_16COLORS, 0x0000);
	bgInitTileSet(1, &CloudTiles, &CloudPalette, 0, (&CloudTiles_end - &CloudTiles), (&CloudPalette_end - &CloudPalette),  BG_4COLORS, 0x1000);
	// Copy Map to VRAM
	bgInitMapSet(0, &Maps, (&Maps_end - &Maps),SC_32x32, 0x2000);
	bgInitMapSet(1, &Mapsc, (&Mapsc_end - &Mapsc),SC_32x32, 0x2400);
	// Now Put in 16 color mode and put cloud on top of screen
	setMode(BG_MODE1, BG3_MODE1_PRORITY_HIGH); bgSetDisable(2);  
	// Set BG3 SubScreen and 
	//bgSetEnableSub(1);
	
	// enable Subscreen Color ADD/SUB and Color addition on BG1 and Backdrop color
	//setColorEffect(CM_SUBBGOBJ_ENABLE, CM_MSCR_BACK | CM_MSCR_BG1);
(http://imageshack.us/a/img713/1436/transparencyex2.jpg)
The BG1 is behind BG0. I read something about "Main screen" and "Sub screen". 
As in this example would be  BG0 in front of the BG1 without transparency in BG_MODE1? it is thus not:
..
bgInitTileSet(1, &LandTiles, &LandPalette, 1, (&LandTiles_end - &LandTiles), (&LandPalette_end - &LandPalette), BG_16COLORS, 0x0000);
bgInitTileSet(0, &CloudTiles, &CloudPalette, 0, (&CloudTiles_end - &CloudTiles), (&CloudPalette_end - &CloudPalette),  BG_4COLORS, 0x1000);
// Copy Map to VRAM
bgInitMapSet(1, &Maps, (&Maps_end - &Maps),SC_32x32, 0x2000);
bgInitMapSet(0, &Mapsc, (&Mapsc_end - &Mapsc),SC_32x32, 0x2400);
..